View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default convert number to text

Dim i As Long, lastrow As Long
lastrow = Range("A1").CurrentRegion.Rows.Count
For i = 1 To lastrow
Cells(i, 8) = "'" & Format(Cells(i, 6), "000")
Next


--
Regards,
Tom Ogilvy


"Scott" wrote:

Here are my codes:

Dim i As Long, lastrow As Long
lastrow = Range("A1").CurrentRegion.Rows.Count
For i = 1 To lastrow
Cells(i, 8) = Format(Cells(i, 6), "000")
Next

I still got numbers, not text.


"Gary''s Student" wrote:

Sub routine()
Dim n As Integer, s As String
n = 5
s = Format(n, "000")
MsgBox (s)
End Sub
--
Gary''s Student
gsnu200711