Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-24-2018, 08:40 AM
jeffreybrown jeffreybrown is offline Need Macro to Convert Numbers from Positive to Negative Windows Vista Need Macro to Convert Numbers from Positive to Negative Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Maybe this will help...

Where do I paste the code that I find on the internet



You should also declare variables within your vba procedures.

Define Variables In VBA

Code:
Option Explicit

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Macro to Convert Numbers from Positive to Negative Need Macro to Convert Text To Numbers in Multiple Sheets rsrasc Excel Programming 4 04-11-2016 06:21 AM
Need Macro to Convert Numbers from Positive to Negative Excel VBA to convert number to negative dakm63 Excel Programming 1 05-26-2015 10:49 AM
Need Macro to Convert Numbers from Positive to Negative Table cells with negative numbers being displayed in two lines HankBrandenburg Word Tables 1 02-17-2014 03:04 PM
Custom formatting to make negative numbers show w/o negative sign on charts todor PowerPoint 3 01-16-2013 03:45 AM
Need Macro to Convert Numbers from Positive to Negative How to add the plus sign (+) automatically for the numbers which are positive? Jamal NUMAN Excel 2 05-01-2011 03:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:10 PM.


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