Results 1 to 19 of 19

Thread: Automatically Converting Value to negative

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Sorry for not making myself clear enough. When I enter an amount in cells E3:F23 and in cell H46 only negative numbers should show there. Any other cells should show whatever sign is input (positive or negative numbers). Your script still changes all numbers in all cells in Sheet1 to negatives but I only require the script to change numbers entered in the cells E3 to F3 and H46. I've cleaned up my script by combining the ranges as shown below. Please tell me what you think. Is there a better way to represent what I am trying to do? Also, can you suggest how I can make it more dynamic when adding rows as mentioned in my previous message.

    
    Private Sub Worksheet_Change(ByVal Rng As Range)
        Dim myCell AsRange
        Set Rng =Range("e3:f23,h46")
        For Each myCellIn Rng
            If myCell.Value<> "" Then
                If IsNumeric(myCell.Value) Then
                    If myCell.Value> 1 Then
                        myCell.Value =myCell.Value * -1
                    End If
                End If
            End If
        Next myCell
    End Sub
    
    Thank you
    Last edited by Aussiebear; 02-11-2025 at 01:11 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •