LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Compile error, Syntax error

I assume that the source is text and NOT numeric with the leading zero
present due to the number format being "00000000".

Either of the following:-

'This code first converts to numeric value then the TRIM function will
return the result as text.
ActiveCell.Formula = "=TRIM(VALUE(B1))"

'This code simply returns all after the first character. Result is text.
ActiveCell.Formula = "=MID(B1,2,255)"

NOTE: You cannot use these formulas in the same cell as the source. If you
want to replace the source then you need to do it differently..

To replace the source values without the leading zeros, then assuming the
the values in column B are text, you can first format the column to general
or number (no decimal places) and then insert the numeral 1 in any blank
cell. Copy the cell with 1 and then select all the data in column B and Paste
Special - Multiply.

--
Regards,

OssieMac


"Steved" wrote:

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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bubble sort Error (Compile Error: Type Mismtach) Excel Monkey[_2_] Excel Programming 6 April 24th 09 12:16 AM
compile/syntax error to save active book to new location on networ Sharon Excel Worksheet Functions 2 March 14th 07 07:51 PM
Syntax and compile error. Jim15[_16_] Excel Programming 6 March 27th 06 04:16 PM
VLOOKUP Compile/Syntax Error JimFor Excel Programming 4 December 22nd 04 06:10 PM


All times are GMT +1. The time now is 03:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"