View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
macgru macgru is offline
external usenet poster
 
Posts: 20
Default 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