Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to save the location of the active cell as a
variable R, so for example, if it was "B4" I want to save R = ActiveCell.? = B4. I want to do this with two variables say R=B4 and S=D12 then I want select the Range(R:S).Select I know the syntax I have written here is wrong so I am looking for some advice I how I can write this in a way Visual Basic will understand. Any help is appreciate. Thanks for your time. Andy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Andrew,
Try something like Dim R As Range Dim S As Range Set R = ActiveCell Set S = Range("D12") Range(R,S).Select -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com "Andrew Johnson" wrote in message ... I want to save the location of the active cell as a variable R, so for example, if it was "B4" I want to save R = ActiveCell.? = B4. I want to do this with two variables say R=B4 and S=D12 then I want select the Range(R:S).Select I know the syntax I have written here is wrong so I am looking for some advice I how I can write this in a way Visual Basic will understand. Any help is appreciate. Thanks for your time. Andy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Andrew,
Sub jskal() 'MsgBox ThisWorkbook.FullName Dim S As String Dim R As String R = ActiveCell.Address S = "$" & Chr(Asc(Mid(R, 2, 1)) + 1) & Mid(R, 3, Len(R) - 1) Range(R, S).Select MsgBox R & ":" & S End Sub losmac Uzytkownik "Andrew Johnson" napisal w wiadomosci ... I want to save the location of the active cell as a variable R, so for example, if it was "B4" I want to save R = ActiveCell.? = B4. I want to do this with two variables say R=B4 and S=D12 then I want select the Range(R:S).Select I know the syntax I have written here is wrong so I am looking for some advice I how I can write this in a way Visual Basic will understand. Any help is appreciate. Thanks for your time. Andy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If Range not equal to zero in Visual Basic If/Then statement | Excel Discussion (Misc queries) | |||
Visual Basic - Variable Sheet Names | Excel Discussion (Misc queries) | |||
changing the visual basic in office 2003 to visual studio net | Excel Discussion (Misc queries) | |||
Visual basic to step through range and store a value based on text attribute value. | Excel Programming | |||
Visual basic to step through range and store a value based on text attribute value. | Excel Programming |