View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro Trouble with Numbering Sequence

W is a string.

You're trying to put an integer (Int()) in that variable.

Jim S wrote:

I used the following Macro in Excel 2003:

Sub FillDownWithDecimals()
Dim X As Long, W As String, F As String, S As String
S = Selection(1).Text
W = Int(S) 'Left(S, InStr(S & ".", ".") - 1)
F = Mid(S, InStr(S & ".0", ".") + 1)
For X = 0 To Selection.Count - 1
With Selection(1).Offset(X)
.NumberFormat = "@"
.HorizontalAlignment = xlRight
.Value = W & "." & F
End With
F = CStr(Val(F + 1))
Next
End Sub

I get a debug error on this line:

W = Int(S) 'Left(S, InStr(S & ".", ".") - 1)

Can't execute code in break mode


--

Dave Peterson