Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I use a variable in the place of a sheet name

In the following code snippet, from a macro I am writing, how do I use
name as a variable rather than a predefined sheet name in this code
line - ActiveCell.Offset(row, col).FormulaR1C1 = "=name!RC*1.0"


Sample code snippet from my Excel macro

Do While ActiveCell.Offset(0, col) < ""
row = 2
Do While ActiveCell.Offset(row, col - 1) < ""
ActiveCell.Offset(row, col).FormulaR1C1 = "=name!RC*1.0"
row = row + 1
Loop
DoEvents
col = col + 1
Loop


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default How do I use a variable in the place of a sheet name

ActiveCell.Offset(row, col).FormulaR1C1 = "=" & name & "!RC*1.0"

--
Kind regards,

Niek Otten

"FCLinux" wrote in message om...
In the following code snippet, from a macro I am writing, how do I use name as a variable rather than a predefined sheet
name in this code line - ActiveCell.Offset(row, col).FormulaR1C1 = "=name!RC*1.0"


Sample code snippet from my Excel macro

Do While ActiveCell.Offset(0, col) < ""
row = 2
Do While ActiveCell.Offset(row, col - 1) < ""
ActiveCell.Offset(row, col).FormulaR1C1 = "=name!RC*1.0"
row = row + 1
Loop
DoEvents
col = col + 1
Loop




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default How do I use a variable in the place of a sheet name

Good Morning,

if name variable is s string type variable, this should do the trick for
you..

enjoy, Rick


Dim name as string

ActiveCell.Offset(row, col).FormulaR1C1 = "=" & name" & "!RC*1.0"




"FCLinux" wrote in message
om...
In the following code snippet, from a macro I am writing, how do I use
name as a variable rather than a predefined sheet name in this code
line - ActiveCell.Offset(row, col).FormulaR1C1 = "=name!RC*1.0"


Sample code snippet from my Excel macro

Do While ActiveCell.Offset(0, col) < ""
row = 2
Do While ActiveCell.Offset(row, col - 1) < ""
ActiveCell.Offset(row, col).FormulaR1C1 =

"=name!RC*1.0"
row = row + 1
Loop
DoEvents
col = col + 1
Loop




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
How do I pull data from one sheet and place it in another? Fred Excel Discussion (Misc queries) 7 April 28th 09 02:30 AM
Use a range value in place of sheet name John Wilson Excel Discussion (Misc queries) 1 February 26th 08 08:46 AM
VBA to place sheet name in cell Hammer_757[_7_] Excel Programming 6 August 30th 05 05:30 PM
Is there a formula that will place the sheet name in a cell? Reed Excel Worksheet Functions 7 January 20th 05 01:29 AM
how to place a variable cell into a range? ozoned Excel Programming 2 August 12th 03 07:58 AM


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