Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Inputting a formula with a Macro

I am running a macro that copies and pastes different reports into one
workbook (each on a different sheet) and then does some formatting and
formula calculations on each sheet. I then reference all of those sheets onto
a summary page. I am currently having an issue with one of my formulas. Here
is the formula:

Range("B3").Select
ActiveCell.FormulaR1C1 = "=(Class_" & i & "_Name)"
The "i" is a variable that changes depending on which sheet is being worked
on. The formula works, but only to a point. The cell named "Class_1_Name" has
a formula to Concatenate other cells on the summary page once they are filled
in. They aren't filled in until after the macro is done running (they are
filled manually). Currently what is happening is the value that is
"Class_1_Name" is being inputted into cell B3 on the current worksheet. I
actually want cell B3 to have in it "=Class_1_Name", not just what that cell
contains when it the macro runs. With all of my other formulas, they actually
appear in the cell when you click on it, but for whatever reason, I can't get
the actual formula to appear in this cell. I even tried to do the formula for
the concatenation that I do on the summary page and it does the same thing.
How do I get the actual formula to go into the cell, so that when the
contents of the cells that are referenced change, the cell on the worksheet
changes?

Please let me know this makes sense. Any help is appreciated.
Thanks,
Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,805
Default Inputting a formula with a Macro

Your problem is not clear..

If i is 1 then your code will enter the following in B3
=(Class_1_Name)
and this is what you would see in the formula box

The cell will show the value in the cell named Class_1_Name, so if that cell
has the formula
=3+4

B3 will show 7... If you fill Class_1_Name later it will show 0 till then.
If name is not defined then it will show #Name error till name is defined...

"prozewski" wrote:

I am running a macro that copies and pastes different reports into one
workbook (each on a different sheet) and then does some formatting and
formula calculations on each sheet. I then reference all of those sheets onto
a summary page. I am currently having an issue with one of my formulas. Here
is the formula:

Range("B3").Select
ActiveCell.FormulaR1C1 = "=(Class_" & i & "_Name)"
The "i" is a variable that changes depending on which sheet is being worked
on. The formula works, but only to a point. The cell named "Class_1_Name" has
a formula to Concatenate other cells on the summary page once they are filled
in. They aren't filled in until after the macro is done running (they are
filled manually). Currently what is happening is the value that is
"Class_1_Name" is being inputted into cell B3 on the current worksheet. I
actually want cell B3 to have in it "=Class_1_Name", not just what that cell
contains when it the macro runs. With all of my other formulas, they actually
appear in the cell when you click on it, but for whatever reason, I can't get
the actual formula to appear in this cell. I even tried to do the formula for
the concatenation that I do on the summary page and it does the same thing.
How do I get the actual formula to go into the cell, so that when the
contents of the cells that are referenced change, the cell on the worksheet
changes?

Please let me know this makes sense. Any help is appreciated.
Thanks,
Paul

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Inputting a formula with a Macro

Unfortunately when I look in the formula box after the macro runs, all it has
is what was in the cell named Class_1_Name at the time the macro ran, not
=(Class_1_Name), which is really what I want. How do I get this to show up in
the formula bar?
Paul

"Sheeloo" wrote:

Your problem is not clear..

If i is 1 then your code will enter the following in B3
=(Class_1_Name)
and this is what you would see in the formula box

The cell will show the value in the cell named Class_1_Name, so if that cell
has the formula
=3+4

B3 will show 7... If you fill Class_1_Name later it will show 0 till then.
If name is not defined then it will show #Name error till name is defined...

"prozewski" wrote:

I am running a macro that copies and pastes different reports into one
workbook (each on a different sheet) and then does some formatting and
formula calculations on each sheet. I then reference all of those sheets onto
a summary page. I am currently having an issue with one of my formulas. Here
is the formula:

Range("B3").Select
ActiveCell.FormulaR1C1 = "=(Class_" & i & "_Name)"
The "i" is a variable that changes depending on which sheet is being worked
on. The formula works, but only to a point. The cell named "Class_1_Name" has
a formula to Concatenate other cells on the summary page once they are filled
in. They aren't filled in until after the macro is done running (they are
filled manually). Currently what is happening is the value that is
"Class_1_Name" is being inputted into cell B3 on the current worksheet. I
actually want cell B3 to have in it "=Class_1_Name", not just what that cell
contains when it the macro runs. With all of my other formulas, they actually
appear in the cell when you click on it, but for whatever reason, I can't get
the actual formula to appear in this cell. I even tried to do the formula for
the concatenation that I do on the summary page and it does the same thing.
How do I get the actual formula to go into the cell, so that when the
contents of the cells that are referenced change, the cell on the worksheet
changes?

Please let me know this makes sense. Any help is appreciated.
Thanks,
Paul

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
Inputting Dates Formula? Scott Excel Discussion (Misc queries) 5 March 22nd 10 07:23 PM
Cell not available when inputting formula Lyn Excel Worksheet Functions 2 April 14th 09 06:38 PM
Inputting numbers using a macro. wazcaster Excel Discussion (Misc queries) 1 September 10th 07 11:38 AM
Inputting SAME formula within EVERY (ALL) Worksheet FLKULCHAR Excel Worksheet Functions 1 September 30th 05 07:13 PM
Help Inputting a Name in a Macro [email protected] Excel Programming 2 April 1st 05 04:23 PM


All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"