Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Excel Macro to select a column based on row heading

Status
Not open for further replies.

extreme00

Technical User
Mar 25, 2008
4
US
Is it possible to create a macro in VB codes to select certain columns based on row heading in Microsoft Excel?

Basically, I need the macro to select the whole column of "Account" before proceeding to do some other formatting just for this column.
Reason i need to macro this is because i have >10 excel files to format, but the column Account always appear in different columns for different files.

Eg File1, i will need to do this: Range("B:B").Select
Type Account Description
Main 1580 Testing
Sub 1480 Test
Main 1111 ABC

For File2, i will need to do this : Range("A:A").Select
Account Admin
1580 X
1480 Y
1111 Z

I've been trying to find the codes to do this, but to no avail .. Can anyone help please?

 
A starting point:
MsgBox Rows(1).Find("Account").Column

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 




Also, I would advise against using the Select Method.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top