Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Modify an existing Cell formula using VBA

If I have a formula in cell A1 that contains the following: "=C1" ...and I
want to KEEP that formula ("=C1") but also ADD to the end if it the
following: "*10" so that it becomes: "=C1*10" using VBA, is that possible?

My users need to select ranges of cells and then multiply them *10 but the
formulas can't be erased while doing this. Right now I have a simple "For
Each MyCell in Selection, MyCell = MyCell*10 but this of course overwrites
the formulas if they are present, so it only works for the cells without
formulas.

Thank You for any advise!!


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Modify an existing Cell formula using VBA

For Each myCell In Selection
If myCell.HasFormula Then
myCell.Formula = mycell.formula & "*10"
End If
Next myCell

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Matt" wrote in message
...
If I have a formula in cell A1 that contains the following: "=C1" ...and I
want to KEEP that formula ("=C1") but also ADD to the end if it the
following: "*10" so that it becomes: "=C1*10" using VBA, is that possible?

My users need to select ranges of cells and then multiply them *10 but the
formulas can't be erased while doing this. Right now I have a simple "For
Each MyCell in Selection, MyCell = MyCell*10 but this of course overwrites
the formulas if they are present, so it only works for the cells without
formulas.

Thank You for any advise!!



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Modify an existing Cell formula using VBA

Hey, thank you!

"Bob Phillips" wrote in message
...
For Each myCell In Selection
If myCell.HasFormula Then
myCell.Formula = mycell.formula & "*10"
End If
Next myCell

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Matt" wrote in message
...
If I have a formula in cell A1 that contains the following: "=C1" ...and
I want to KEEP that formula ("=C1") but also ADD to the end if it the
following: "*10" so that it becomes: "=C1*10" using VBA, is that
possible?

My users need to select ranges of cells and then multiply them *10 but
the formulas can't be erased while doing this. Right now I have a simple
"For Each MyCell in Selection, MyCell = MyCell*10 but this of course
overwrites the formulas if they are present, so it only works for the
cells without formulas.

Thank You for any advise!!





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
Modify A formula carl Excel Worksheet Functions 1 March 14th 06 05:46 PM
Modify a formula Eintsein_mc2 Excel Discussion (Misc queries) 3 September 18th 05 05:43 AM
insert a new cell into an existing formula Debbie Excel Discussion (Misc queries) 3 March 14th 05 06:46 PM
Can a Formula in Cell X modify Cell Y? alMandragor Excel Discussion (Misc queries) 7 February 10th 05 09:51 PM
How do I modify an existing worksheet to remove columns & contents Gil Gray Excel Discussion (Misc queries) 1 February 10th 05 05:52 PM


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