Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default vba variable value via cell reference

I do not know the proper syntax
for the fourth line of this sample code.

1. Dim S as Long
2. Dim X as Long
3. For X = 5 To 55
4. S = Range("G&'X'&")
5. Next x

Please change my gloomy day to a bright shining wonder.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,726
Default vba variable value via cell reference

S = Range("G" & X)


"Bill (Unique as my name)" wrote in message
oups.com...
I do not know the proper syntax
for the fourth line of this sample code.

1. Dim S as Long
2. Dim X as Long
3. For X = 5 To 55
4. S = Range("G&'X'&")
5. Next x

Please change my gloomy day to a bright shining wonder.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default vba variable value via cell reference

Thanks Bob!

Bob Phillips wrote:
S = Range("G" & X)


"Bill (Unique as my name)" wrote in message
oups.com...
I do not know the proper syntax
for the fourth line of this sample code.

1. Dim S as Long
2. Dim X as Long
3. For X = 5 To 55
4. S = Range("G&'X'&")
5. Next x

Please change my gloomy day to a bright shining wonder.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 947
Default vba variable value via cell reference

for the fourth line of this sample code.
4. S = Range("G&'X'&")


If I understand correctly, perhaps one of these ideas:

Sub Demo()
Dim S As Long
Dim X As Long
For X = 5 To 55
S = Range("G" & X)
Next X
End Sub

'Or perhaps to avoid using strings...

Sub Demo2()
Dim S As Long
Dim R As Long '(R)ow
For R = 5 To 55
S = Cells(R, 7)
Next R
End Sub

--
HTH :)
Dana DeLouis
Windows XP & Office 2003


"Bill (Unique as my name)" wrote in message
oups.com...
I do not know the proper syntax
for the fourth line of this sample code.

1. Dim S as Long
2. Dim X as Long
3. For X = 5 To 55
4. S = Range("G&'X'&")
5. Next x

Please change my gloomy day to a bright shining wonder.



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
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Lookup Data in two seperate Spreadsheets Padraig Excel Worksheet Functions 6 June 28th 06 03:05 PM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
Cell Reference Math Ralph Howarth Excel Worksheet Functions 0 January 26th 05 06:27 PM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM


All times are GMT +1. The time now is 06:41 AM.

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"