View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Worksheetfunction Substitute

Sub PurchaseReport()

Dim JDEdata

'Correct JDE Credit Format

Range("G4").Select

For x = 4 To myRows
JDEdata = Range("G" & x)

If Right(JDEdata, 1) = "-" Then

JEData = "-" & Left(JEData, Len(JEData) - 1)

End If
Next x
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Helen" wrote in message
...
This macro is supposed to reformat numbers that have a "-" sign in them.
Placing the "-" at the front instead of the end of the number.

I'm getting an error message asking me to define the sub / function, what
have I done wrong?

Sub PurchaseReport()

Dim JDEdata

'Correct JDE Credit Format

Range("G4").Select

For x = 4 To myRows
JDEdata = Range("G" & x)

If Right(JDEdata, 1) = "-" Then

Application.WorksheetFunction = Substitute(JDEdata, "-", , 1)

Application.WorksheetFunction = Substitute(JDEdata, Left(JDEdata), "-"
&
Left(JDEdata), 1)

End If
Next x