Range column and row using variables

D

Daniel

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
 
J

Jim Thomlinson

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...
 
G

Gary''s Student

Range is useful for a string input, try:

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


instead
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top