• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

macro to multiply all constant numbers of column D by 1.03 of all worksheets in the workbook & rounded off result upto 2 decimal no.

yogeshjoshi2020

New Member
Hi all of you

I'm very new to the macro world..!!

I need a macro to multiply all constant numbers of column D by 1.03 of all worksheets in the workbook & rounded off result up to 2 decimal no.


I have tried below code which is helping me out with single sheet result but I have so many sheets in the workbook can you help me through to get the result of all sheet at one go..

>>> use code - tags <<<
Code:
Sub Macro5()

On Error Resume Next

Set C = Range("d1:D500").Cells.SpecialCells(xlCellTypeConstants)

For Each cc In C

cc.Value = Format(cc.Value * 1.03, "#.00")


Next

End Sub

Any help will be much appreciated.

Many Many thanks in advance :):DD ..!!
 
Last edited by a moderator:
Code:
Sub Multiply_Constants()

' Declare Current as a worksheet object variable.
Dim WS As Worksheet

On Error Resume Next

' Loop through all of the worksheets in the active workbook.
For Each WS In Worksheets

    Dim cc As Range, c As Range
    Set c = WS.Range("d1:D500").Cells.SpecialCells(xlCellTypeConstants)
    
    For Each cc In c
        cc.Value = Format(cc.Value * 1.03, "#.00")
    Next cc
    
Next WS

End Sub
 
Back
Top