View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
AltaEgo AltaEgo is offline
external usenet poster
 
Posts: 245
Default Compile error, Syntax error

It seems you were after:

"=RIGHT(B2,LEN(B2)-1)"


This is better (no need to activate cells)

Sub TrimBCol1stChar()

Range("C2:C25").Formula = "=RIGHT(RC[-1],LEN(RC[-1])-1)"

'substitute C2:C25 with our range
'requiring the formula.

End Sub




NOTES:
1) the above will trim the length irrespective whether the first character
is 0.
2) the [-1] in the formula is telling EXCEL to work out the reference for
the same row, one column left In other words, if you wanted to put it in D
instead of C to still work for column B values:

Range("d2:d25").Formula = "=RIGHT(RC[-2],LEN(RC[-2])-1)"


--
Steve

"Steved" wrote in message
...
Hello from Steved

In Col B:B I'm asking to be removed the leading "0" ie 07075601 to be
7075601

Thankyou.


"OssieMac" wrote:

Not sure what you are trying to do. Can you post a sample of the source
data
and a sample of the result that the formula should return.


--
Regards,

OssieMac


"Steved" wrote:

Hello from Steved


I should know but I'm not thinking to clearly.

I am getting a Compile error, Syntax error for the below why I
thankyou.

Sub Removezero()
ActiveCell.FormulaR2C3 = "=MID(B2,1+(LEFT(B2)="0"),99)"
End Sub