Thread: [Solved] Need Help with Current Macro
View Single Post
 
Old 10-26-2018, 04:08 AM
rsrasc rsrasc is offline Windows 10 Office 2013
Competent Performer
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default Need Help with Current Macro

Hi all,

The following macro was given to me in a previous post and it is working great.


Code:
Sub test()
    Dim Cell As Range
    Dim ws As Worksheet
    For Each ws In Worksheets(Array("130R", "135R", "140R"))
        For Each Cell In ws.Range("E4:P45")
            If Cell.Value > 0 Then
                Cell.Value = Cell.Value * -1
            End If
        Next Cell
    Next ws
End Sub
Now, due to some unexpected changes, I would like to know if the above macro can be modified.

For example the below code will not changed
Code:
For Each ws In Worksheets(Array("130R", "135R", "140R"))
The same as

Code:
For Each Cell In ws.Range("E4:P45")
            If Cell.Value > 0 Then
                Cell.Value = Cell.Value * -1

In my file in column B, from row 4 to 43, I have different account numbers.

For example, some of the accounts listed in Column B are the following:

Circulation-All Other Single-Gross Sales
Circulation-All Other Single-Gross Sales (Sun)
Other Printing Revenue
Other Printing Services-Quick Print

Therefore, since only these accounts needs to be converted to negative, I was wondering how this can be accomplished.

As always, thank you in advance for your assistance and cooperation.

Cheers!
rsrasc
Reply With Quote