Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Referrring to cells by their column header
You can use Find. For instance, the following sets the value of the sixth
cell in the column on the active worksheet whose header (in the first row) is "abc" to "P". Rows(1).Find("abc").EntireColumn.Rows(6).Value = "P" Or set a reference to the column to use later, but check to see if found Dim rng as Range On Error Resume Next Set rng = Rows(1).Find("abc").EntireColumn If rng is Nothing then 'range not found 'do something Else 'do something else rng.Rows(6).Value = "P" End If On Error Goto 0 Bob "Fred Smith" wrote in message ... I'm working with an export file that contains several columns each headed by a description. However, there's no guarantee what order the columns will be in. In VBA, is there a way I can refer to a cell, and/or a column, by its description (much like the sort function does)? -- Thanks, Fred Please reply to newsgroup, not e-mail |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Average cells based on column header | Excel Discussion (Misc queries) | |||
Retriving column header for non empty cells in a row | Excel Worksheet Functions | |||
Return column number from column header text | Excel Discussion (Misc queries) | |||
Get Intersection value given column header and row header | Excel Discussion (Misc queries) | |||
Split cells below header column: | Excel Worksheet Functions |