#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Named Range

Assume the name of the Range is MyRange

Dim cell as Range
for each cell in Range("MyRange")
if isnumeric(cell) then ' necessary in xl97
if cell.value = 10 then cell.value = 20
End if
Next cell

or

Dim cell as Range
for each cell in Range("MyRange").SpecialCells(xlConstants,xlNumber s)
if cell.value = 10 then cell.value = 20
Next cell

--
Regards,
Tom Ogilvy


"Mark M." wrote in message
...
I have a named range that is 10 rows by 10 columns.

If possible, I'd like to use the "For Each" construct to
go thru the range.

Could somebody give me some sample code?

I would think the code would look some thing like this:

Dim clCell as Cell
For Each clCell in NamedRange
if clCell.Value = 10 then clCell.value = 20
Next clCell

Thank you for your help,

MarkM




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Thanks for the help

Dim'ing the Cell as a range is obvious now that I see it.

Thanks for the clear thinking.

Mark


-----Original Message-----
Assume the name of the Range is MyRange

Dim cell as Range
for each cell in Range("MyRange")
if isnumeric(cell) then ' necessary in xl97
if cell.value = 10 then cell.value = 20
End if
Next cell

or

Dim cell as Range
for each cell in Range("MyRange").SpecialCells

(xlConstants,xlNumbers)
if cell.value = 10 then cell.value = 20
Next cell

--
Regards,
Tom Ogilvy


"Mark M." wrote in message
...
I have a named range that is 10 rows by 10 columns.

If possible, I'd like to use the "For Each" construct

to
go thru the range.

Could somebody give me some sample code?

I would think the code would look some thing like this:

Dim clCell as Cell
For Each clCell in NamedRange
if clCell.Value = 10 then clCell.value = 20
Next clCell

Thank you for your help,

MarkM




.

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
Join non-contiguous ranges into one range via named range? ker_01 Excel Discussion (Misc queries) 3 May 1st 09 11:09 AM
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 PM
automatic range - named range give me circular reference... George Thorogood Excel Discussion (Misc queries) 0 February 22nd 07 07:53 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM


All times are GMT +1. The time now is 08:05 PM.

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"