Link to home
Start Free TrialLog in
Avatar of Sandra Smith
Sandra SmithFlag for United States of America

asked on

Loop through range and update four worksheets from old value to new

I have a workbook that creates four worksheets with data that will be uploaded into an ACCESS database. The worksheet names are ("chrts", "Top10", "gics", "Ctry").   However, due to user changes, some of the row headers needs to be changed.  That is, say a row is labled "Market Cap" in the source data, but needs to be changed to "Market Capilization" on the upload worksheet.  I have a two-column range ("RowHeaderChanges") that has the OldRowHeader column and a NewRowHeader column which holds this old/new information.  So, how do I loop through this range and change the values?  I need locate in column A on each worksheet the value "Market Cap" and change it to "Market Caplization", and then go to the next old value in the range, loop through the worksheets checking for this value and update to the new value if it is found.  All this must be done in VBA.
Public Sub UpdateRowHeaders()
Dim varGroup As Variant

For Each varGroup In Array("chrts", "Top10", "gics", "Ctry")
    

Next

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sandra Smith

ASKER

Cannot use the Used range as there are multiple area on the worksheet that are used by code.  I need to restrict the range to the named range.  The intersect won't work for this scenario as the range does not interesect.  I willl need to clean up the workbook before I can post as this is confidential data.  I was thinking about this and was wondering if filling an array with the data adn then using the array to compare the upload to.  I have to work on another issue today so will not be able to get back to this until tomorrow.
I shall wait for the sample file.
I found an easiser way to answer the original question, this this answer did solve another problem I came across.  Thank you.