Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Public Sub ProcessData()

Public Sub ProcessData()
Dim i As Long, j As Long
Dim LastRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = 2 To LastRow

If .Cells(i, "E").Value < "" Then

If Len(.Cells(i, "E").Text) < 6 Then

.Cells(i, "E").Value = "'" & Left("00000", 6 - _
Len(.Cells(i, "E").Value)) & _
.Cells(i, "E").Value
End If
End If
Next i
End With

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Public Sub ProcessData()

Not sure why you posted your message (I don't see it as a response to
anything in my newsreader); however I wanted to point out that this line....

.Cells(i, "E").Value = "'" & Left("00000", 6 - _
Len(.Cells(i, "E").Value)) & _
.Cells(i, "E").Value


can be replaced with this slightly shorter (and perhaps more
straightforward) one...

..Cells(i, "E").Value = "'" & Right("000000" & .Cells(i, "E").Value, 6)

Rick


"Bob Phillips" wrote in message
...
Public Sub ProcessData()
Dim i As Long, j As Long
Dim LastRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = 2 To LastRow

If .Cells(i, "E").Value < "" Then

If Len(.Cells(i, "E").Text) < 6 Then

.Cells(i, "E").Value = "'" & Left("00000", 6 - _
Len(.Cells(i, "E").Value)) & _
.Cells(i, "E").Value
End If
End If
Next i
End With

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)





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
Public is not Public clara Excel Programming 4 May 18th 07 03:21 PM
Public? Chip Pearson Excel Programming 0 January 17th 07 11:28 PM
Use of PUBLIC BillCPA Excel Programming 6 June 7th 06 01:41 PM
public sub Bob Excel Programming 3 December 10th 04 08:49 PM
Public Sub Help No Name Excel Programming 2 May 18th 04 11:09 PM


All times are GMT +1. The time now is 04:00 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"