Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select a range based on what's in the row header?
I would like my macro to look for the word "Date" and then create a
range called "Date_Column", rather than hard-coding it that Date will always be column B, column D, etc. Any suggestions or pointers to tutorials? Thanks, Rachel |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select a range based on what's in the row header?
Uzytkownik "Rachel Garrett" napisal w wiadomosci ... I would like my macro to look for the word "Date" and then create a range called "Date_Column", rather than hard-coding it that Date will always be column B, column D, etc. Any suggestions or pointers to tutorials? Thanks, Rachel u can try with Sub add_name() Column = ActiveSheet.Rows(1).Find(What:="Date").Column ActiveWorkbook.Names.Add Name:="Date_Column", RefersToR1C1:=Cells(1, Column)' i assume it is row 1 End Sub mcg |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select a range based on what's in the row header?
Sub date_finder()
For Each r In ActiveSheet.UsedRange If r.Value = "Date" Then Set Date_Column = Columns(r.Column) Exit For End If Next End Sub -- Gary''s Student - gsnu200795 "Rachel Garrett" wrote: I would like my macro to look for the word "Date" and then create a range called "Date_Column", rather than hard-coding it that Date will always be column B, column D, etc. Any suggestions or pointers to tutorials? Thanks, Rachel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
vba - Select Used Range minus the top header | Excel Programming | |||
Select sheets based on what is in a range. | Excel Programming | |||
How can I select a range of cells for header? | Excel Programming | |||
How to select a range based on values in 1 column | Excel Programming | |||
Can I select a range based on the cell's contents? | Excel Programming |