Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-26-2018, 04:08 AM
rsrasc rsrasc is offline Need Help with Current Macro Windows 10 Need Help with Current Macro Office 2013
Competent Performer
Need Help with Current Macro
 
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with Current Macro Macro to auto-save pdf using text on page + current date hysterical.useless Word VBA 12 02-05-2018 02:17 PM
Need Help with Current Macro macro, data import from the ONLY text file in current folder ue418 Excel Programming 5 10-28-2017 12:52 PM
a macro that can copy data from copy.xls to our current excel macro.xls based on criteria: udhaya Excel Programming 1 11-12-2015 10:12 AM
A macro that moves the current paragraph up or down? New Daddy Word VBA 2 04-13-2014 02:25 PM
Need Help with Current Macro Macro for moving one cell down from current position Johnny thunder Word VBA 3 04-07-2011 04:44 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:02 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft