View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim S[_3_] Jim S[_3_] is offline
external usenet poster
 
Posts: 26
Default Macro Trouble with Numbering Sequence


Hi Dave,

I recieved this as a Macro from your team as I was trying to fill numbers
down a column A associated with the items I had in column B. I tried to run
this Macro and got the error. Maybe I don't know how to put the Macro in or I
don't know what I need to do to get the Macro to work. As I don't know the
difference between the string and interger.



"Dave Peterson" wrote:

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