View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Need help with named ranges

Dim rng As Range

With Workbooks(WorkbookMain).Worksheets("sheetname")
Set rng = .Range("Data_EMCSoftware")
.Range(rng, rng.End(xlDown)).Name = "Data_EMCSoftwareList"

Set rng = .Range("Data_SoftwareExclude")
.Range(rng, rng.End(xlDown)).Name = "Data_SoftwareExludeList"

Set rng = .Range("Data_SoftwareInclude")
.Range(rng, rng.End(xlDown)).Name = "Data_SoftwareIncludeList"

End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Trefor" wrote in message
...
The below code works, but I need to be able to select the sheet first. Is

it
possible to do this with selecting the sheet, which in my case is (Visible

=
False)

Sheets("sheetname").Select
With Workbooks(WorkbookMain).Sheets("sheetname")
.Range("Data_EMCSoftware").Select
.Range(Selection, Selection.End(xlDown)).Select
Selection.name = "Data_EMCSoftwareList"

.Range("Data_SoftwareExclude").Select
.Range(Selection, Selection.End(xlDown)).Select
Selection.name = "Data_SoftwareExludeList"

.Range("Data_SoftwareInclude").Select
.Range(Selection, Selection.End(xlDown)).Select
Selection.name = "Data_SoftwareIncludeList"

End With
--
Trefor