PDA

View Full Version : Check if Column Exist & it in sequance



izet99
08-20-2009, 08:27 AM
Hi, I have question...I have been search around but I couldn't find anything that would fit my needs.

How I can check that certain column exist and each column is right sequence.

I have put together macro that runs on my reports, reports coming from multiple source, right now macro run fine but I would like to create some type of validation to check if columns exist or have extra column and they are in right place otherwise my macro might blowout. My micro is not dynamic to recognize specific column by name. So if i have this validation it would warning me about changes in report design so I can alter my macro or just move extra column to the lust column where I don't have any calculation before I run my macro.

Is this possible to make:

- Check for column heading if it exist in range from A1:O1 or Array of column names
if exist = do nothing
Else = let me know, some type output message to a user and stop macro
- Check if column is in right sequence
if in right sequence = do nothing
Else = let me know, some type output message to a user and stop macro
- Check what's is new, what column is added
if new column is added between any of column in range then = move to the first empty/available column
Else = do nothing

Rest of macro will executed from here

If somebody has any ideas on how to do this it would be of great help to me. I'm have attached sheet with column heading only.

Thanks a lot for any help on this issue.