Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Remove zeros from cell data

Hi Kaziglu,

Try:
'=============
Public Sub Tester003()
Dim SH As Worksheet
Dim rng As Range
Dim rCell As Range
Const col As String = "A" '<<==== CHANGE

Set SH = ActiveSheet '<<==== CHANGE
Set rng = Range(col & "1:" & col & _
Cells(Rows.Count, col).End(xlUp).Row)

For Each rCell In rng.Cells
With rCell
.Value = CLng(.Value)
End With
Next rCell

rng.NumberFormat = "0"

End Sub
'<<=============


---
Regards,
Norman


"Kaziglu Bey"
wrote in message
...

I have a column of information that comes to me with extra zeros tacked
on the left side of the data. It is similar to:

002047
000301
000027

What I need is help inserting code in a macro that will make the
information look like:

2047
301
27

It has to be in a macro as this information interferes with a current
macro and needs be changed in the process.

The numbers can be as different as the ones above; where one cell may
have two zeros and the next may have one that need removed.

Thanks!


--
Kaziglu Bey
------------------------------------------------------------------------
Kaziglu Bey's Profile:
http://www.excelforum.com/member.php...o&userid=36086
View this thread: http://www.excelforum.com/showthread...hreadid=571396



Reply
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
Remove columns containing all zeros Nora_GG Excel Worksheet Functions 2 June 1st 10 10:44 PM
How do I remove zeros from a linked blank cell? Scott Excel Discussion (Misc queries) 3 August 29th 08 08:44 PM
Remove leading zeros from downloaded data Carla Excel Discussion (Misc queries) 9 September 14th 07 08:51 PM
remove preceding zeros Bruce Excel Worksheet Functions 2 July 27th 07 02:52 PM
Remove zeros xgirl Excel Worksheet Functions 8 April 13th 05 01:18 PM


All times are GMT +1. The time now is 10:42 PM.

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

About Us

"It's about Microsoft Excel"