Results 1 to 4 of 4

Thread: subscript out of range (Excel)

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    2

    subscript out of range (Excel)

    long story short, i haven't used dynamic variables before and i'm not sure why i keep getting this subscript out of range error -- as soon as it gets to the row i've starred it crashes wih the error - in the debugger i can see that the value of ActiveCell is just "Trade Ticket"

    VB Code:
    1. Dim trigger As String
    2.     Dim Labels() As String
    3.     Dim Data() As Variant
    4.     Dim inputRow As Integer
    5.     Dim inputCol As Integer
    6.     Dim counter As Integer
    7.  
    8.     counter = 0
    9.     inputRow = 1
    10.     inputCol = 1
    11.     Do While trigger <> "InputEnd" ' finds rows with data
    12.         If trigger = "Input" Then ' takes data out of relevant rows
    13.             inputRow = ActiveCell.Row
    14.             inputCol = ActiveCell.Column
    15.             Do While ActiveCell.Offset(0, 1) <> "End"
    16.                 Label = ActiveCell.Value
    17.         ****        Labels(counter) = ActiveCell.Value
    18.                 Data(counter) = ActiveCell.Offset(1, 0).Value
    19.                 counter = counter + 1
    20.             Loop
    21.         Else
    22.         End If
    23.         inputRow = inputRow + 1
    24.         Cells(inputRow, inputCol).Select
    25.         trigger = ActiveCell.Value
    26.     Loop
    Last edited by RobDog888; Jul 7th, 2006 at 01:52 PM. Reason: Added [vbcode] tags

Posting Permissions

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



Click Here to Expand Forum to Full Width