Excel Function or VBA Code to remove leading ZERO ?

Maverick27

Active Member
Joined
Sep 23, 2010
Messages
336
Office Version
  1. 2013
Platform
  1. Windows
Attn Excel Gurus.

Anyone care to share Excel Function or VBA Code to remove all leading 'ZERO' (0's) from Col. cell(s) of data ?

See example below:

feGSAb


https://ibb.co/feGSAb

Col D: Input Data
Col E: Output Data

Thanks in Advance
 
Last edited:

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Heres some VBA:

Code:
Dim sh As Worksheet, lr As Long

Set sh = Sheets("Sheet1")
lr = sh.Range("D" & Rows.Count).End(xlUp).Row

With sh.Range("E1:E" & lr)
    .NumberFormat = "General"
    .Value = sh.Range("D1:D" & lr).Value
End With

Or if you want to do it cell by cell you can simply add zero to the cell in D1. For example in E1:

=D1+0
 
Upvote 0

Forum statistics

Threads
1,224,943
Messages
6,181,917
Members
453,071
Latest member
Gizmo2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top