ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Dealing with column headers (https://www.excelbanter.com/excel-worksheet-functions/200208-dealing-column-headers.html)

Pawan

Dealing with column headers
 
Hi...

I am learning about writing macros. I always stuck up at one point.
I need to do various activies on columns based on their headings. e.g. I
have to replace all "NA" in the column whose heading is "TOWN". Currently I
write the macro using column number. But if the columns gets shifted, then
this macro will not work. How can I extract column number by identifying its
heading?

Regards,
Pawan

Bob Phillips[_3_]

Dealing with column headers
 
colNo = Application.Match("TOWN",Rows(1),0))

and use colNo.


--
__________________________________
HTH

Bob

"Pawan" wrote in message
...
Hi...

I am learning about writing macros. I always stuck up at one point.
I need to do various activies on columns based on their headings. e.g. I
have to replace all "NA" in the column whose heading is "TOWN". Currently
I
write the macro using column number. But if the columns gets shifted, then
this macro will not work. How can I extract column number by identifying
its
heading?

Regards,
Pawan




Pawan

Dealing with column headers
 
Thats perfect...

Thanks Bob.. :-)

"Bob Phillips" wrote:

colNo = Application.Match("TOWN",Rows(1),0))

and use colNo.


--
__________________________________
HTH

Bob

"Pawan" wrote in message
...
Hi...

I am learning about writing macros. I always stuck up at one point.
I need to do various activies on columns based on their headings. e.g. I
have to replace all "NA" in the column whose heading is "TOWN". Currently
I
write the macro using column number. But if the columns gets shifted, then
this macro will not work. How can I extract column number by identifying
its
heading?

Regards,
Pawan






All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com