PDA

View Full Version : Solved: increase value(s) by different fixed percentage via a macro



Pete
09-08-2008, 11:00 AM
see attached workbook
Hi Experts

Need a macro that well do the following when the user enter a value into the table as shown in worksheet "Scenario 1" columns T:X

Sequence of steps

1. If the user add the value 2 to column V2 (Against ALL Products) then all the product in column N, row 10 onwards in worksheet "Scenario 1" increase by 2%.

2. The value in cell v2 worksheet "Scenario1" changes once the macro button has been clicked to bold font and colour red, making the user aware.

3. If the user click the reset button they return back to the origianl value less the increase and the colour red and bold font

mdmackillop
09-08-2008, 11:30 AM
There is no sheet Scenario1
Links in the workbook are causing excel to freeze.

Pete
09-08-2008, 12:26 PM
worksheet 1 should have been named scenario 1........

Pete
09-08-2008, 12:31 PM
ok got removed the links...........try this workbook.

mdmackillop
09-08-2008, 01:08 PM
This is simplified if you format U2 as % and enter the value as 102%

Sub Apply()
With Sheets("Scenario 1")
Set Rng = Range(.Cells(10, 14), .Cells(Rows.Count, 14).End(xlUp))
.Range("U2").Copy
Rng.PasteSpecial Operation:=xlMultiply
Application.CutCopyMode = False
With Rng.Font
.Bold = True
.Color = 255
End With
.Range("U2").Select
End With
End Sub

Sub Reset()
With Sheets("Scenario 1")
Set Rng = Range(.Cells(10, 14), .Cells(Rows.Count, 14).End(xlUp))
.Range("U2").Copy
Rng.PasteSpecial Operation:=xlDivide
Application.CutCopyMode = False
With Rng.Font
.Bold = False
.Color = xlblack
End With
.Range("U2").Select
End With
End Sub

Pete
09-08-2008, 01:39 PM
thanks for the feedback works prefectly.