On Friday, January 4, 2013 11:32:46 AM UTC-8, tb wrote:
I am using Microsoft Excel 2007 (32-bit) on a Windows 7 desktop.
Management has decided to increase the list prices of our products by
an across-the-board, fixed percentage.
Given the variety and options offered with our products, list prices
are calculated using a series of Excel tables, whereby the final list
price is obtained by going to one or more tables and adding the amount
specified in each appropriate cell at the intersection of rows/columns.
Is there a _quick_ method that I can use to add this fixed X percentage
increase to all the cells who have a $ price in them? (Luckily we are
raising all our prices by a single X percentage!)
I am thinking of something like highlighting all the cells of a table
that have $ amounts in them and then issuing some command that would
multiply the contents by this fixed X percentage. This is probably not
possible but one never knows what the Gurus can come up with...
--
tb
Hi tb,
Joeu2004's last-offered code is most likely as good as it gets or needs to be.
You can try this approach and see if it suits you.
Select your price data range and name it DataP.
Enter the percentage value in cell P1.
(If you want to change the percentage, you can do so on the sheet
and not have to go to the
vb editor and change code %.)
Hopefully, Joeu2004 will look at this code and make sure I did not
inadvertently lead you astray.
Run this code.
Option Explicit
Sub RoundSelection()
Dim Cell As Range
Range("P1").Copy
Range("DataP").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
For Each Cell In Range("DataP")
Cell.Value = WorksheetFunction.Round(Cell.Value, 2)
Cell.NumberFormat = "0.00"
Next Cell
Application.CutCopyMode = False
Range("P1").Select
End Sub
Regards,
Howard