Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Replace Cell Value with Formula

I havea bout 30 spreadsheets (Inherited format and size) that currently have
"input" sections highlighted in yellow. The numbers entered into the yellow
section are currently in thousands, and now they want them converted to whole
numbers. I am working on a macro to find the yellow color and replace the
current cell value with cell value * 1000. I get the part where it finds the
color, but how do I write the macro to use a formula for the replacement? I
want yellow cell value * 1000. How do I write this? Or is there a better way
to do it?

Thanks!
Mary
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Replace Cell Value with Formula

what you want to do is to take the old formula and multiply by 1000. I would
ptu an new set of parethesis around the old formula lile this

newformula = 1000 * (Old formula).

You also ned to rempve the old equal sign

OldFormula = range("A1").formula
OLdFormula = mid(OldFormula,2) 'remove old equal sign
NewFormula = "=1000*(" & Oldformula & ")"
Range("A1").formula = Newformula

"MaryMalone" wrote:

I havea bout 30 spreadsheets (Inherited format and size) that currently have
"input" sections highlighted in yellow. The numbers entered into the yellow
section are currently in thousands, and now they want them converted to whole
numbers. I am working on a macro to find the yellow color and replace the
current cell value with cell value * 1000. I get the part where it finds the
color, but how do I write the macro to use a formula for the replacement? I
want yellow cell value * 1000. How do I write this? Or is there a better way
to do it?

Thanks!
Mary

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Replace Cell Value with Formula

This macro:

Sub malone()
For Each r In ActiveSheet.UsedRange
If r.Interior.ColorIndex = 6 Then
r.Value = 1000 * r.Value
End If
Next
End Sub

will, for example, convert yellow cells have a value of 1.234 to 1234
--
Gary''s Student - gsnu200784


"MaryMalone" wrote:

I havea bout 30 spreadsheets (Inherited format and size) that currently have
"input" sections highlighted in yellow. The numbers entered into the yellow
section are currently in thousands, and now they want them converted to whole
numbers. I am working on a macro to find the yellow color and replace the
current cell value with cell value * 1000. I get the part where it finds the
color, but how do I write the macro to use a formula for the replacement? I
want yellow cell value * 1000. How do I write this? Or is there a better way
to do it?

Thanks!
Mary

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Replace Cell Value with Formula

That was perfect!!! Thanks a ton!

"Gary''s Student" wrote:

This macro:

Sub malone()
For Each r In ActiveSheet.UsedRange
If r.Interior.ColorIndex = 6 Then
r.Value = 1000 * r.Value
End If
Next
End Sub

will, for example, convert yellow cells have a value of 1.234 to 1234
--
Gary''s Student - gsnu200784


"MaryMalone" wrote:

I havea bout 30 spreadsheets (Inherited format and size) that currently have
"input" sections highlighted in yellow. The numbers entered into the yellow
section are currently in thousands, and now they want them converted to whole
numbers. I am working on a macro to find the yellow color and replace the
current cell value with cell value * 1000. I get the part where it finds the
color, but how do I write the macro to use a formula for the replacement? I
want yellow cell value * 1000. How do I write this? Or is there a better way
to do it?

Thanks!
Mary

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
Can I replace a ' at the beginning of a text cell using Replace Hilde Excel Discussion (Misc queries) 4 September 10th 07 06:22 PM
How do I replace text within a formula with a diff cell value? Eric_G Excel Worksheet Functions 1 July 18th 07 03:30 PM
Formula to Replace or eliminate any sheetname(s) in formula string EagleOne Excel Discussion (Misc queries) 0 September 20th 06 06:36 PM
How Do I find/replace a blank cell with a formula? Alvin Excel Worksheet Functions 2 June 23rd 06 08:25 PM
Excel - create button to replace cell content with cell value blackmot Excel Worksheet Functions 3 December 7th 05 05:10 PM


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