Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have a named range that covers A1:d4 - How do I loop through each cell in Column C of the named range. I know how to do it for a 'non-named' range but not for a named range TIA Andi |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would be inclined to use the intersect method something like this
dim rngToSearch as Range dim rng as range on error resume next set rngtosearch = intersect(columns("C"), range("MyRange")) on error goto 0 if rngtosearch is nothing then msgbox "The range name changed and we have a problem." else for each rng in rngtosearch msgbox rng.address next rng end if -- HTH... Jim Thomlinson "Andibevan" wrote: Hi, I have a named range that covers A1:d4 - How do I loop through each cell in Column C of the named range. I know how to do it for a 'non-named' range but not for a named range TIA Andi |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim myCell as range
dim myRng as range set myrng = worksheets("somesheet").range("somename") for each mycell in myrng.columns(3).cells msgbox mycell.address '??? next mycell There better be at least 3 columns in that range! Andibevan wrote: Hi, I have a named range that covers A1:d4 - How do I loop through each cell in Column C of the named range. I know how to do it for a 'non-named' range but not for a named range TIA Andi -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Dave - I was messing around with that idea but had missed the .cell
off the end of the statement Ta muchly "Dave Peterson" wrote in message ... Dim myCell as range dim myRng as range set myrng = worksheets("somesheet").range("somename") for each mycell in myrng.columns(3).cells msgbox mycell.address '??? next mycell There better be at least 3 columns in that range! Andibevan wrote: Hi, I have a named range that covers A1:d4 - How do I loop through each cell in Column C of the named range. I know how to do it for a 'non-named' range but not for a named range TIA Andi -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It's not always required, but it never hurts (and it can be painful if you
needed it and didn't use it!). Andibevan wrote: Thanks Dave - I was messing around with that idea but had missed the .cell off the end of the statement Ta muchly "Dave Peterson" wrote in message ... Dim myCell as range dim myRng as range set myrng = worksheets("somesheet").range("somename") for each mycell in myrng.columns(3).cells msgbox mycell.address '??? next mycell There better be at least 3 columns in that range! Andibevan wrote: Hi, I have a named range that covers A1:d4 - How do I loop through each cell in Column C of the named range. I know how to do it for a 'non-named' range but not for a named range TIA Andi -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Query Named Range Return Single Column Value | Excel Worksheet Functions | |||
Find first blank cell in single column named range | Excel Programming | |||
Redefining a Named Range In A Loop | Excel Programming | |||
Loop thru named range of second sheet | Excel Programming | |||
Identifying single column within named range | Excel Discussion (Misc queries) |