Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Need help with named ranges

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Need help with named ranges

Bob,

Perfect, many thanks.

--
Trefor


"Bob Phillips" wrote:

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Need help with named ranges

Bob,

I just found a catch, if the cell contains a formula that resolves to a
blank the .Range(rng, rng.End(xlDown)).Name still runs to the end of the
cells containing a formula. I am trying to capture only the cells that have a
value other than "", is this possible?

--
Trefor


"Trefor" wrote:

Bob,

Perfect, many thanks.

--
Trefor


"Bob Phillips" wrote:

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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Need help with named ranges

Trefor,

Do you mean that it goes to the end of the column? If so, if say
Data_EMCSoftware is blank, what should be selected/

--
HTH

Bob Phillips

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

"Trefor" wrote in message
...
Bob,

I just found a catch, if the cell contains a formula that resolves to a
blank the .Range(rng, rng.End(xlDown)).Name still runs to the end of the
cells containing a formula. I am trying to capture only the cells that

have a
value other than "", is this possible?

--
Trefor


"Trefor" wrote:

Bob,

Perfect, many thanks.

--
Trefor


"Bob Phillips" wrote:

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







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help with named ranges

I'd just look.

Dim DestCell as Range
....
With Workbooks(WorkbookMain).Worksheets("sheetname")
Set rng = .Range("Data_EMCSoftware")
set DestCell = rng.end(xldown)
do
if destcell.row = rng.row then
'stop looking, at the top of the range
exit do
end if
if destcell < "" then
exit do
else
'come up a row and continue testing
set destcell = destcell.offset(-1,0)
end if
loop
.Range(rng, destcell)).Name = "Data_EMCSoftwareList"
.....




Trefor wrote:

Bob,

I just found a catch, if the cell contains a formula that resolves to a
blank the .Range(rng, rng.End(xlDown)).Name still runs to the end of the
cells containing a formula. I am trying to capture only the cells that have a
value other than "", is this possible?

--
Trefor

"Trefor" wrote:

Bob,

Perfect, many thanks.

--
Trefor


"Bob Phillips" wrote:

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




--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Need help with named ranges

Dave,

Sorry for the delay in getting back to you. This worked a treat thankyou.

--
Trefor


"Dave Peterson" wrote:

I'd just look.

Dim DestCell as Range
....
With Workbooks(WorkbookMain).Worksheets("sheetname")
Set rng = .Range("Data_EMCSoftware")
set DestCell = rng.end(xldown)
do
if destcell.row = rng.row then
'stop looking, at the top of the range
exit do
end if
if destcell < "" then
exit do
else
'come up a row and continue testing
set destcell = destcell.offset(-1,0)
end if
loop
.Range(rng, destcell)).Name = "Data_EMCSoftwareList"
.....




Trefor wrote:

Bob,

I just found a catch, if the cell contains a formula that resolves to a
blank the .Range(rng, rng.End(xlDown)).Name still runs to the end of the
cells containing a formula. I am trying to capture only the cells that have a
value other than "", is this possible?

--
Trefor

"Trefor" wrote:

Bob,

Perfect, many thanks.

--
Trefor


"Bob Phillips" wrote:

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




--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Need help with named ranges

Bob,

Thankyou for your reply, Dave nailed it in his reply.

--
Trefor


"Bob Phillips" wrote:

Trefor,

Do you mean that it goes to the end of the column? If so, if say
Data_EMCSoftware is blank, what should be selected/

--
HTH

Bob Phillips

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

"Trefor" wrote in message
...
Bob,

I just found a catch, if the cell contains a formula that resolves to a
blank the .Range(rng, rng.End(xlDown)).Name still runs to the end of the
cells containing a formula. I am trying to capture only the cells that

have a
value other than "", is this possible?

--
Trefor


"Trefor" wrote:

Bob,

Perfect, many thanks.

--
Trefor


"Bob Phillips" wrote:

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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Named Ranges Rich Excel Worksheet Functions 2 February 6th 08 05:37 AM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Excel Programming 0 August 21st 06 03:51 PM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
named ranges - changing ranges with month selected gr8guy Excel Programming 2 May 28th 04 04:50 AM
Named Ranges Neal[_5_] Excel Programming 3 October 23rd 03 02:09 PM


All times are GMT +1. The time now is 07:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"