Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default value of one cell in a named range

Hi,

I've been trying to find how to do this and don't seem to find what I am
looking for. How would I go about doing this?

I have a named range that is 2 columns wide and 18 rows long. I want to use
an if then statement to check the value of a specific cell (10,1) and if the
value is greater than 0, call another proceedure.


MyGrid = ("F11:N13")
MyLabel = ("E11:E13")

If MyNamedRange(.cells(10,1).value 0 then
Call NewProceedure(MyGrid,MyLabel)
End If

I get an error with this. The called proceedure is to add labels and
borders to a group of cells. I am usure if MyGrid and MyLabel should be
defined as a range or a string.

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default value of one cell in a named range

Karen,

Imagine your named range as a grid and you can refer it individual cells
within it like this:-

Sub sonic()
x = Range("myrange").Item(2, 2).Value
End Sub

item refers to row, column.
It's also useful to note that you can use this method to refer to cells
outside your named range so a 3,3 grid could iuse the reference 3,4 which
would rer to the column to the right of your grid.

So to return item 10,1 is
x = Range("myrange").Item(10, 1).Value

where "myrange" is the name of your range.

Mike

"Karen53" wrote:

Hi,

I've been trying to find how to do this and don't seem to find what I am
looking for. How would I go about doing this?

I have a named range that is 2 columns wide and 18 rows long. I want to use
an if then statement to check the value of a specific cell (10,1) and if the
value is greater than 0, call another proceedure.


MyGrid = ("F11:N13")
MyLabel = ("E11:E13")

If MyNamedRange(.cells(10,1).value 0 then
Call NewProceedure(MyGrid,MyLabel)
End If

I get an error with this. The called proceedure is to add labels and
borders to a group of cells. I am usure if MyGrid and MyLabel should be
defined as a range or a string.

Thanks for your help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default value of one cell in a named range

Thank you, Mike!

"Mike H" wrote:

Karen,

Imagine your named range as a grid and you can refer it individual cells
within it like this:-

Sub sonic()
x = Range("myrange").Item(2, 2).Value
End Sub

item refers to row, column.
It's also useful to note that you can use this method to refer to cells
outside your named range so a 3,3 grid could iuse the reference 3,4 which
would rer to the column to the right of your grid.

So to return item 10,1 is
x = Range("myrange").Item(10, 1).Value

where "myrange" is the name of your range.

Mike

"Karen53" wrote:

Hi,

I've been trying to find how to do this and don't seem to find what I am
looking for. How would I go about doing this?

I have a named range that is 2 columns wide and 18 rows long. I want to use
an if then statement to check the value of a specific cell (10,1) and if the
value is greater than 0, call another proceedure.


MyGrid = ("F11:N13")
MyLabel = ("E11:E13")

If MyNamedRange(.cells(10,1).value 0 then
Call NewProceedure(MyGrid,MyLabel)
End If

I get an error with this. The called proceedure is to add labels and
borders to a group of cells. I am usure if MyGrid and MyLabel should be
defined as a range or a string.

Thanks for your help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default value of one cell in a named range

And explicitly using Item is superfluous.

x = Range("myrange")(10,1).Value

works fine.

Alan Beban

Mike H wrote:
Karen,

Imagine your named range as a grid and you can refer it individual cells
within it like this:-

Sub sonic()
x = Range("myrange").Item(2, 2).Value
End Sub

item refers to row, column.
It's also useful to note that you can use this method to refer to cells
outside your named range so a 3,3 grid could iuse the reference 3,4 which
would rer to the column to the right of your grid.

So to return item 10,1 is
x = Range("myrange").Item(10, 1).Value

where "myrange" is the name of your range.

Mike

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
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 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
named cell range Marilyn Excel Worksheet Functions 2 March 13th 06 07:42 PM
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM
Getting named range from a cell Dandog Excel Programming 2 January 10th 05 06:01 AM


All times are GMT +1. The time now is 07:56 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"