Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default change values to formulas

I've seen a lot of threads addressing changing formulas to values, but
haven't come across one going the other way. I have a spreadsheet that gets
created with all values. Column E is the sum of columns C and D. I'm trying
to figure out the code that will go through column E, and at every occurance
of a number, replace that number with the formula =C+D.

I tried using Isnumeric as a test, but it plugged that formula into all the
blank cells as well.
If IsNumeric(ActiveCell.Value) Then ActiveCell.FormulaR1C1 = "=RC[-2]+RC[-1]"

Suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default change values to formulas

I should have said

if not activecell.value like "*=*" then


"mattmac" wrote:

I've seen a lot of threads addressing changing formulas to values, but
haven't come across one going the other way. I have a spreadsheet that gets
created with all values. Column E is the sum of columns C and D. I'm trying
to figure out the code that will go through column E, and at every occurance
of a number, replace that number with the formula =C+D.

I tried using Isnumeric as a test, but it plugged that formula into all the
blank cells as well.
If IsNumeric(ActiveCell.Value) Then ActiveCell.FormulaR1C1 = "=RC[-2]+RC[-1]"

Suggestions?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default change values to formulas

Try looking for the "=" sign.

if activecell.value like "*=*" then ...

"mattmac" wrote:

I've seen a lot of threads addressing changing formulas to values, but
haven't come across one going the other way. I have a spreadsheet that gets
created with all values. Column E is the sum of columns C and D. I'm trying
to figure out the code that will go through column E, and at every occurance
of a number, replace that number with the formula =C+D.

I tried using Isnumeric as a test, but it plugged that formula into all the
blank cells as well.
If IsNumeric(ActiveCell.Value) Then ActiveCell.FormulaR1C1 = "=RC[-2]+RC[-1]"

Suggestions?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default change values to formulas

I'm sorry if I wasn't clear: The cells just have numbers in them, no
formulas. I want to change the value to a formula.

"Barb Reinhardt" wrote:

Try looking for the "=" sign.

if activecell.value like "*=*" then ...

"mattmac" wrote:

I've seen a lot of threads addressing changing formulas to values, but
haven't come across one going the other way. I have a spreadsheet that gets
created with all values. Column E is the sum of columns C and D. I'm trying
to figure out the code that will go through column E, and at every occurance
of a number, replace that number with the formula =C+D.

I tried using Isnumeric as a test, but it plugged that formula into all the
blank cells as well.
If IsNumeric(ActiveCell.Value) Then ActiveCell.FormulaR1C1 = "=RC[-2]+RC[-1]"

Suggestions?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default change values to formulas

Try this

if not activecell.value like "*=*"

this will find the active cells that don't have a formula.


"mattmac" wrote:

I'm sorry if I wasn't clear: The cells just have numbers in them, no
formulas. I want to change the value to a formula.

"Barb Reinhardt" wrote:

Try looking for the "=" sign.

if activecell.value like "*=*" then ...

"mattmac" wrote:

I've seen a lot of threads addressing changing formulas to values, but
haven't come across one going the other way. I have a spreadsheet that gets
created with all values. Column E is the sum of columns C and D. I'm trying
to figure out the code that will go through column E, and at every occurance
of a number, replace that number with the formula =C+D.

I tried using Isnumeric as a test, but it plugged that formula into all the
blank cells as well.
If IsNumeric(ActiveCell.Value) Then ActiveCell.FormulaR1C1 = "=RC[-2]+RC[-1]"

Suggestions?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default change values to formulas

How about?

If IsNumeric(ActiveCell.Value) and isempty(activecell.value) = False Then

--
Thanks,

Bruce Bolio


"mattmac" wrote:

I've seen a lot of threads addressing changing formulas to values, but
haven't come across one going the other way. I have a spreadsheet that gets
created with all values. Column E is the sum of columns C and D. I'm trying
to figure out the code that will go through column E, and at every occurance
of a number, replace that number with the formula =C+D.

I tried using Isnumeric as a test, but it plugged that formula into all the
blank cells as well.
If IsNumeric(ActiveCell.Value) Then ActiveCell.FormulaR1C1 = "=RC[-2]+RC[-1]"

Suggestions?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default change values to formulas

Adding the "isempty" code works perfectly! Thanks!!!

I've tried the "if not activecell.value like "*=*" then" code and was still
getting the same error where all blank cells were getting populated with
formulas.

"Bruce Bolio" wrote:

How about?

If IsNumeric(ActiveCell.Value) and isempty(activecell.value) = False Then

--
Thanks,

Bruce Bolio


"mattmac" wrote:

I've seen a lot of threads addressing changing formulas to values, but
haven't come across one going the other way. I have a spreadsheet that gets
created with all values. Column E is the sum of columns C and D. I'm trying
to figure out the code that will go through column E, and at every occurance
of a number, replace that number with the formula =C+D.

I tried using Isnumeric as a test, but it plugged that formula into all the
blank cells as well.
If IsNumeric(ActiveCell.Value) Then ActiveCell.FormulaR1C1 = "=RC[-2]+RC[-1]"

Suggestions?

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
Formulas aren't updating when values change Andrew K. Excel Worksheet Functions 4 November 17th 08 10:03 PM
CELLS NOT CALC FORMULAS - VALUES STAY SME FORMULAS CORRECT?? HELP Sherberg Excel Worksheet Functions 4 September 11th 07 01:34 AM
Change formulas into values based on cell color Aria[_2_] Excel Programming 2 October 23rd 06 10:55 PM
Formulas not recalculating when values change on another sheet Bill Excel Worksheet Functions 0 September 15th 05 10:29 PM
is there a way to change formulas to values for sorting purposes? Change formulas to values Excel Worksheet Functions 3 September 2nd 05 05:15 AM


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