ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range column and row using variables (https://www.excelbanter.com/excel-programming/395098-range-column-row-using-variables.html)

Daniel

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

Jim Thomlinson

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


Gary''s Student

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



All times are GMT +1. The time now is 01:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com