Thread: Declaration?
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default Declaration?

Here is one idea.

Sub Demo()
Dim n, Result
n = 1
Result = Format$(n, """PS-03-""00000")
MsgBox Result
End Sub


If it's used in a loop over many cells, perhaps make the format a constant.

Sub Demo2()
Dim n, Result
Const Fmt As String = """PS-03-""00000"
n = 123

Result = Format$(n, Fmt)
MsgBox Result
End Sub

HTH
--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"TJF" wrote in message
...
5 digits is enough for me. I need it for list of items.
example: PS-03-00001

So i need something like:

MyNumber = 1
result = "PS-03-" & MyNumber
msgbox result (or Range("A1") = result)
-------------------------------------
PS-03-00001
-------------------------------------

Thanks

"Rollin_Again" píše v diskusním
příspěvku ...
Will your number scheme (including leading zeroes) always be 6 digits
long? What is the smallest and largest scheme of numbers that you can
possible have?


Rollin


---
Message posted from http://www.ExcelForum.com/