Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default Range column and row using variables

Hello,

I have been successful at using a singular variable to be used in the Range
property, such as

Workbooks("date_tracking.xls").Sheets("parameters" ).Range("B" & i).Value

But can't seem to figure out how to use 2 variables, 1 for row and 1 for
column.

strCol = "B"
i = 2
Workbooks("date_tracking.xls").Sheets("parameters" ).Range(strCol & i).Value

Could someone enlighten me as to my mistake and the proper synthax.

Thank you,

Daniel P
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Range column and row using variables

What you have should work however you are better off with Cells than Range in
this case...

Workbooks("date_tracking.xls").Sheets("parameters" ).Cells(i, strCol).Value

Double check the spelling of your workbbok and sheet...
--
HTH...

Jim Thomlinson


"Daniel" wrote:

Hello,

I have been successful at using a singular variable to be used in the Range
property, such as

Workbooks("date_tracking.xls").Sheets("parameters" ).Range("B" & i).Value

But can't seem to figure out how to use 2 variables, 1 for row and 1 for
column.

strCol = "B"
i = 2
Workbooks("date_tracking.xls").Sheets("parameters" ).Range(strCol & i).Value

Could someone enlighten me as to my mistake and the proper synthax.

Thank you,

Daniel P

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Range column and row using variables

Range is useful for a string input, try:

Sub daniel()
rrow = 7
ccolumn = "B"
Cells(rrow, ccolumn).Value = 1234
End Sub


instead
--
Gary''s Student - gsnu200736


"Daniel" wrote:

Hello,

I have been successful at using a singular variable to be used in the Range
property, such as

Workbooks("date_tracking.xls").Sheets("parameters" ).Range("B" & i).Value

But can't seem to figure out how to use 2 variables, 1 for row and 1 for
column.

strCol = "B"
i = 2
Workbooks("date_tracking.xls").Sheets("parameters" ).Range(strCol & i).Value

Could someone enlighten me as to my mistake and the proper synthax.

Thank you,

Daniel P

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
VBA Range Variables... MarkHear1 Excel Programming 2 February 15th 07 11:53 AM
Set few range variables at once Greg Excel Programming 4 November 15th 06 01:01 AM
Range of variables Ed Excel Programming 2 August 5th 06 03:05 PM
Using variables in the Range command Chi Man Wong Excel Programming 2 March 2nd 05 03:35 PM
Range Variables Daniel[_7_] Excel Programming 1 November 20th 03 05:45 AM


All times are GMT +1. The time now is 02:10 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"