Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
the following is my current code: For Each t In Sheets("Tasks").Range("A2:A500") I'd like to define a name refer to ("A2:A500") and use that name in the above code, how can I do it. Clara -- thank you so much for your help |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim clara as String
clara="A2:A500" For Each t In Sheets("Tasks").Range(clara) -- Gary''s Student - gsnu200793 "clara" wrote: Hi all, the following is my current code: For Each t In Sheets("Tasks").Range("A2:A500") I'd like to define a name refer to ("A2:A500") and use that name in the above code, how can I do it. Clara -- thank you so much for your help |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Gary,
thank you for your help -- thank you so much for your help "Gary''s Student" wrote: Dim clara as String clara="A2:A500" For Each t In Sheets("Tasks").Range(clara) -- Gary''s Student - gsnu200793 "clara" wrote: Hi all, the following is my current code: For Each t In Sheets("Tasks").Range("A2:A500") I'd like to define a name refer to ("A2:A500") and use that name in the above code, how can I do it. Clara -- thank you so much for your help |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is one way:
Sub fh() Sheets(1).Range("B2:B5").Name = "SomeName" End Sub You can also just use a variable for code purposes: SomeName = Range("B2:B5") The difference is that when you use the range name as the object it would be Range("SomeName") and is a range object. The other would be a variable that could be used as a value - SomeName - or a range - SomeName.Address and a few other variations depending on your declarations. "clara" wrote: Hi all, the following is my current code: For Each t In Sheets("Tasks").Range("A2:A500") I'd like to define a name refer to ("A2:A500") and use that name in the above code, how can I do it. Clara -- thank you so much for your help |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi JLGWhiz
thank you for your help Clara -- thank you so much for your help "JLGWhiz" wrote: Here is one way: Sub fh() Sheets(1).Range("B2:B5").Name = "SomeName" End Sub You can also just use a variable for code purposes: SomeName = Range("B2:B5") The difference is that when you use the range name as the object it would be Range("SomeName") and is a range object. The other would be a variable that could be used as a value - SomeName - or a range - SomeName.Address and a few other variations depending on your declarations. "clara" wrote: Hi all, the following is my current code: For Each t In Sheets("Tasks").Range("A2:A500") I'd like to define a name refer to ("A2:A500") and use that name in the above code, how can I do it. Clara -- thank you so much for your help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Value issue | Excel Programming | |||
Msg Box VBA Issue | Excel Programming | |||
For Next Issue | Excel Programming | |||
Sub name issue | Excel Programming | |||
With and End With issue | Excel Programming |