View Single Post
  #25   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Spliting digits up to fit paper form

Amended example:
If user cancels InputBox...

Sub ParseAmountsRick3()
Dim Cell As Range, sFormat As String, Size As Long
Size = Application.InputBox("Enter the number of digits", Type:=1)
If Not Size = False Then
sFormat = Mid$(Replace(String(Size, "@"), "@", "_@"), 2)
For Each Cell In Selection
Cell.Offset(, 1).Resize(, Size) = _
Split(Format(Replace( Cell.Value, ".", ""), sFormat), "_")
Next
End If 'Not Size = False
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc