A variable in VB

E

ecando

Hi,
I am new VB coding and want to do the following:

Range("B12").Value = myVariable

But ... where the cloumn heading is a variable also



I have been able to write it as:

cellRef = columnVar + "12"
Range("cellRef").Value = myVariable

Is it possible to parse the line 'Range("B12").Value = myVariable' so
that B is a variable also??
:confused:
Thanks for any ideas help
 
C

Chip Pearson

Try something like

Dim R As Long
Dim C As String
R = 12
C = "B"
Cells(R,C).Value = myVariable


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
R

Ron de Bruin

Try this

columnVar = "B"
cellRef = columnVar & 12
'Range(cellRef).Value = myVariable
Range(cellRef).Select
 
E

ecando

Chip said:
Try something like

Dim R As Long
Dim C As String
R = 12
C = "B"
Cells(R,C).Value = myVariable


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

EXACTLY what I need ...
Thanks Chip
:)
 
Top