Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Visual Basic Range variable

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Visual Basic Range variable

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
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
If Range not equal to zero in Visual Basic If/Then statement Clinton W Excel Discussion (Misc queries) 3 May 2nd 09 11:17 PM
Visual Basic - Variable Sheet Names MarkT Excel Discussion (Misc queries) 10 December 18th 07 07:12 PM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM
Visual basic to step through range and store a value based on text attribute value. Bob Phillips[_5_] Excel Programming 1 August 8th 03 02:50 PM
Visual basic to step through range and store a value based on text attribute value. Bob Kilmer Excel Programming 0 August 7th 03 09:46 PM


All times are GMT +1. The time now is 07:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"