VBA to change header name

Anandpersad

New Member
Joined
Oct 18, 2014
Messages
31
Hi All,
</SPAN></SPAN>
I have a VBA which checks which columns I need. The ones I do not need are deleted.</SPAN></SPAN>
From the remaining columns I need to change the column header. </SPAN></SPAN>
I have a VBA which does that. So far so good.</SPAN></SPAN>
But what I am looking for , is VBA which will find the particular header name and change it to the new name. If found than change, if not found go to the next search to change.</SPAN></SPAN>
If not found a pop up message should appear with the header name which was not found.</SPAN></SPAN>
And so on till last column is found and changed or not found and a message pops up.</SPAN></SPAN>

I am using the following VBA</SPAN></SPAN>

Dim Found As Range</SPAN></SPAN>
Set Found = Rows(1).Find(What:="Concernno", LookIn:=xlValues, lookat:=xlWhole)</SPAN></SPAN>
If Found Is Nothing Then Exit Sub</SPAN></SPAN>
Found.Value = "Concern/Ultimate parent ID"</SPAN></SPAN>

Set Found = Rows(1).Find(What:="Name", LookIn:=xlValues, lookat:=xlWhole)</SPAN></SPAN>
If Found Is Nothing Then Exit Sub</SPAN></SPAN>
Found.Value = "Concern/Ultimate parent name"</SPAN></SPAN>

Set Found = Rows(1).Find(What:="Holdingno", LookIn:=xlValues, lookat:=xlWhole)</SPAN></SPAN>
If Found Is Nothing Then Exit Sub</SPAN></SPAN>
Found.Value = "Holding/parent ID"</SPAN></SPAN>

Set Found = Rows(1).Find(What:="Name", LookIn:=xlValues, lookat:=xlWhole)</SPAN></SPAN>
If Found Is Nothing Then Exit Sub</SPAN></SPAN>
Found.Value = "Holding/parent name"</SPAN></SPAN>

Set Found = Rows(1).Find(What:="Clientno", LookIn:=xlValues, lookat:=xlWhole)</SPAN></SPAN>
If Found Is Nothing Then Exit Sub</SPAN></SPAN>
Found.Value = "Client ID"</SPAN></SPAN>

Thanks in Advance</SPAN></SPAN>

Anandpersad</SPAN></SPAN>
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top