On Apr 5, 9:32 am, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> Sub switch()
> lstRw = Cells(Rows.Count, 3).End(xlUp).Row
> Set myRng = Range("$C$2:$C" & lstRw)
> For Each c in myRng
> If c > 0 Then
> cRng = c.Address
> Range(cRng).Offset(0, -1) = Range(cRng).Value *v(-1)
> Range(cRng) = 0
> End If
> Next
> End Sub
>
> "bander...@nwws.biz" wrote:
> > To all the programming Guru's out there.
> > I'm trying to make some VB code that will look at a column and if the
> > value in that column is greater than 0,
> > move it to the corresponding column to the left and change the sign to
> > a negative.
> > Below is an example of data I am using.
> > Column A B C
> > CASH 125.00 0
> > CASH2 0 180.00
> > CASH3 0 12,000.00
>
> > So in the rows with cash2 and cash 3 I would like to move those values
> > to column B and make
> > them negative.
> > Below is the code I have that will move data based on an input box but
> > I have to put the value I want to change in there, and it will not
> > make the value negative. I would rather have this input box be set to
> > not equal to what I put in the box, but I'm not sure that an Input box
> > is designed to do that? Any help would be greatly appreciated.
> > Thank you
>
> > Sub Move_Stuff()
> > Dim topCel As Range
> > Dim bottomCel As Range
>
> > whatval = InputBox("Enter a Value")
>
> > Set topCel = Range("C1")
> > Set bottomCel = Cells((800), topCel.Column).End(xlUp)
> > If bottomCel.Row >= topCel.Row Then
> > With Range(topCel, bottomCel)
> > Set c = .Find(whatval, LookIn:=xlValues, LookAt:=xlPart)
> > If Not c Is Nothing Then
> > Do
> > c.Cut Destination:=c.Offset(0, -1)
> > Set c = .FindNext
> > Loop While Not c Is Nothing
> > End If
> > End With
> > End If
> > End Sub
GLJWhiz,
Thank you for the help that worked perfectly for what I was looking
for.
Thank you again!!
|