Results 1 to 3 of 3
  1. #1

    Compile Error (2003)

    I found this macro in post 586380, I was trying to use it to number the rows in "A" column if "B" column has an entry. I keep getting a compile error - "Expected End Sub" but the End Sub command is there????

    What am I doing wrong?

    Sub number_rows_a_column()
    ' number_rows_a_column Macro
    ' Macro recorded 8/15/2006 by Stan Sanders

    Sub AddNumbers()
    Dim lngRow As Long
    Dim lngMaxRow As Long
    Dim lngNum As Long
    lngMaxRow = Range("B65536").End(xlUp).Row
    For lngRow = 3 To lngMaxRow
    If Not Range("B" & lngRow) = "" Then
    lngNum = lngNum + 1
    Range("A" & lngRow) = lngNum
    End If
    Next lngRow
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: Compile Error (2003)

    You have two lines starting with Sub:

    Sub number_rows_a_column()
    Sub AddNumbers()

    Remove one of the two.

  3. #3

    Re: Compile Error (2003)

    Thanks a bunch <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts