Macro Trouble with Numbering Sequence
First, I don't have a team.
Second,
Integers are whole numbers: ..., -3, -2, -1, 0, 1, 2, 3, ....
Strings are text: "This is Text", "This is more Text", "A"
Third, I'm not sure what you're trying to do but maybe:
W = CStr(Int(S))
But you haven't shared (in this thread at least) what's in the top cell of the
selection and what you want to do with the rest of the cells in that selection.
Jim S wrote:
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
--
Dave Peterson
|