Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2005, 05:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default Normalization and comparisons

Normalization and comparisons

Hi all.

I need to update an Excel spreadsheet that contains hundreds of rows. What I want do to is get an query from SAP as an Excel file and then do some comparisons and update the relevant cells (e.g. delete, update and insert). Have any of your guys done this kind of stuff before? Any tips ‘n tricks is appreciated.

Thanks in advance!

 - mega
Moving to C# .NET
__________________
- mega
Aspiring JavaScript Ninja
 
Old March 7th, 2005, 08:59 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not a SAP user but from memory I believe it is a relational database where data can be extracted using any normal ODBC or similar db connectivity method. In these circumstances I would recommend use of the MS Query tool in Excel where you create a query against the database and once the data is refreshed then have the VB analyse the data in some shape of form.

SAP say in their website they have a relationship with SAPDB.org, they say it is an environment where you can connect to SAP using ODBC or similar methods, have you had a look, unfortunately due to firewall restrictions I cant see this site.

Have a go.

Matthew



 
Old March 7th, 2005, 02:01 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default

Thanks Matthew.
Getting the data is achieved but I still got two spreadsheets that I need to unify (and perhaps normalize). I figure I need to write a macro but I'm not sure how to go about it.

If you could point me to some sort of tutorial about inserting data from one spreadsheet to another, it would be great. I got a unique identifier so I am able to distinguish rows based on that (actually there is a bit inconsistency, so a msg box where I can choose to updated or not is probably needed). This update will contain:
• Updated data (need to identify a record an updated it)
• New data (need to insert new rows)
• Some data will be missing in the new spreadsheet (need to delete or mark rows as obsolete).

Just need a pointer :)

 - mega
Moving to C# .NET
 
Old March 7th, 2005, 02:05 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I could but you can create multiple sets of data in one long recordset, this is called a Union Query. as follows

select Col1, col2, col3 from data1 where condition1 = 'Apple'
union
select Col1, col2, col3 from data2 where condition1 = 'Banana'
union
select Col1, col2, col3 from data3 where condition1 = 'Canape';


convert this statement into your syntax and see what you get. You should find all the data in one sheet now.

cheers

Matthew






Similar Threads
Thread Thread Starter Forum Replies Last Post
special date/time comparisons hamffjs Access VBA 3 July 12th, 2006 11:41 AM
Performance comparisons Jim Dean BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 4 July 8th, 2006 01:22 PM
Time Comparisons of Nodes Neal XSLT 4 February 16th, 2006 11:38 AM
Speed and Normalization foddie MySQL 5 January 18th, 2006 01:39 PM
Database Normalization Teqlump Access 7 September 1st, 2004 04:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.