Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A variable in VB

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??

Thanks for any ideas help


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default A variable in VB

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



"ecando " wrote in
message ...
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??

Thanks for any ideas help


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default A variable in VB

Try this

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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"ecando " wrote in message ...
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??

Thanks for any ideas help


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A variable in VB

Chip Pearson wrote:
[b]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
:)


---
Message posted from http://www.ExcelForum.com/

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
variable height variable width stacked bar charts ambthiru Charts and Charting in Excel 3 January 18th 06 11:41 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 03:35 PM.

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"