• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Vba code to remove leading zeros in excel column I

Sanoj

Member
Hello Guys...

I am looking for a macro code which should remove all leading zeros from column I and convert the column format to numbers without any decimals.

Could someone please help?

Example:

SAP_CC
0376
0376
0330
0360
0503
0503
0376
0584
0584
0584


Thanks
Sanoj
 
Hello Guys...

I am looking for a macro code which should remove all leading zeros from column I and convert the column format to numbers without any decimals.

Could someone please help?

Example:

SAP_CC
0376
0376
0330
0360
0503
0503
0376
0584
0584
0584


Thanks
Sanoj
see if this works for u
 

Attachments

  • macro.xlsm
    15.9 KB · Views: 6
Hi,

leading zero means it's formatted as text. You can also simply do the same in xl itself.

Meanwhile try this.

Code:
Sub change_text()
    [A2:A11].Value = [A2:A11].Value
End Sub

or

Code:
Sub change_text2()
    [A9999] = 1
    [A9999].Copy
    Range("A2:A11").PasteSpecial Paste:=xlPasteValues, Operation:=xlMultiply
    [A9999] = ""
End Sub
 
Hi,

leading zero means it's formatted as text. You can also simply do the same in xl itself.

Meanwhile try this.

Code:
Sub change_text()
    [A2:A11].Value = [A2:A11].Value
End Sub

or

Code:
Sub change_text2()
    [A9999] = 1
    [A9999].Copy
    Range("A2:A11").PasteSpecial Paste:=xlPasteValues, Operation:=xlMultiply
    [A9999] = ""
End Sub
Thanks Deepak its working as expected :)
 
Hi Sanoj,

for non-vba, you can use the following:
Enter 1 in any separate cell
Copy
Select your range (suppose A2:A11)
Press Ctrl+Alt+V (Paste Special)
select Multiply
OK

Regards,
 
Hi Sanoj,

for non-vba, you can use the following:
Enter 1 in any separate cell
Copy
Select your range (suppose A2:A11)
Press Ctrl+Alt+V (Paste Special)
select Multiply
OK

Regards,

Thanks Khalid but I need macro coding to embed with other code which I have.. I appreciate you help thank you so much.
 
Back
Top