Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to verify headers

I can't remember what the best way to post this is... what group or
groups, I mean, so my apologies if this too not appropriate.

We receive 3-4 files per month. These are flat files; a header row
with a variable number of records on the following rows. We have a
process for importing them into a SQLServer database, after a few
steps in Excel.

But far more regularly than we would like, we find the file has
changed: a column added (sometimes at the end, sometimes in the
middle), a col deleted, etc. We aren't the primary customer, so we
don't have any say in this.

So it's on us to test that the header row matchs what we expect. I'm
building a macro to test this, and if it does not match, get a mini-
report of what's different.

Now, my first thought is a low-tech solution I've used befo put the
expected headers in the "driver" file, and just copy the headers from
the new file into the next row, and go thru and test that
range(1).value = range(2).value. A bit more than that, but that's the
jist.

My second thought is to capture the new file's headers into an array
variable and hardcode the expected values into the code, then compare
that way.

With either of these, I still need an efficient way to report on the
results. That's only tricky if aberrations are found. I guess a new
worksheet in the driver file is a reasonable option.

So I have two questions:
1. Has anyone done this and figured out an elegant way of
accomplishing this?

2. Can anyone point me towards a website with the basics of working
with array variables, populating, retrieving from same, etc? I think I
remember how to populate but I haven't really worked with them since I
first learned Excel's VBA many moons ago.

Thanks,
NJ

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How to verify headers

Take a look at this. Maybe it will help.

http://office.microsoft.com/en-us/ma...176501033.aspx

" wrote:

I can't remember what the best way to post this is... what group or
groups, I mean, so my apologies if this too not appropriate.

We receive 3-4 files per month. These are flat files; a header row
with a variable number of records on the following rows. We have a
process for importing them into a SQLServer database, after a few
steps in Excel.

But far more regularly than we would like, we find the file has
changed: a column added (sometimes at the end, sometimes in the
middle), a col deleted, etc. We aren't the primary customer, so we
don't have any say in this.

So it's on us to test that the header row matchs what we expect. I'm
building a macro to test this, and if it does not match, get a mini-
report of what's different.

Now, my first thought is a low-tech solution I've used befo put the
expected headers in the "driver" file, and just copy the headers from
the new file into the next row, and go thru and test that
range(1).value = range(2).value. A bit more than that, but that's the
jist.

My second thought is to capture the new file's headers into an array
variable and hardcode the expected values into the code, then compare
that way.

With either of these, I still need an efficient way to report on the
results. That's only tricky if aberrations are found. I guess a new
worksheet in the driver file is a reasonable option.

So I have two questions:
1. Has anyone done this and figured out an elegant way of
accomplishing this?

2. Can anyone point me towards a website with the basics of working
with array variables, populating, retrieving from same, etc? I think I
remember how to populate but I haven't really worked with them since I
first learned Excel's VBA many moons ago.

Thanks,
NJ


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot verify XNPV with PV or HP-12C ncw Excel Worksheet Functions 4 May 9th 09 12:35 AM
lookup using column headers and row headers Memphus01 Excel Discussion (Misc queries) 1 April 13th 09 04:57 PM
Hide Column Headers but not row (Headers) Kevan Gradwell Excel Programming 1 March 16th 07 05:59 PM
Verify Input WLMPilot Excel Programming 4 November 1st 06 08:35 PM
Verify email Sandee Excel Discussion (Misc queries) 1 February 9th 05 04:01 PM


All times are GMT +1. The time now is 11:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"