Results 1 to 6 of 6

Thread: [RESOLVED] Counting

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    34

    Resolved [RESOLVED] Counting

    I'm trying to make a changable worksheet. I've opted to go with 3 arrays (1 1 dimensional, other is 2, other is 3 dimensional) - my current issue is . . .

    Private Sub RemoveRun_Click()
    If RunBox.Text = "New Run" Or RunBox.Text = "Your Runs Are" Then
    Else
    For CurrentRun = LBound(RunArray) To UBound(RunArray)
    If RunArray(CurrentRun) = RunBox.Text Then
    CurrentRun = UBound(RunArray)
    DeletionRun = CurrentRun
    End If
    Next CurrentRun
    Range("B15") = DeletionRun
    End If
    End Sub

    Doesn't work as intended. Range("B15") is returning the string of what is in RunArray (DeletionRun = currentrun was deletionrun = runarray(currentrun) and it still had the issue)

    I simply need to find a way to get the current location it is at (ex: RunArray = option 3, which would be somethingsomething) rather then (somethingsomething) as I need DeletionRun to be populated with a number and not a text. Thanks for all your help.

  2. #2
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Bloomingdale, IL USA
    Posts
    284

    Re: Counting

    Posting your workbook would help... it's hard to understand your issue.

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Counting

    i have no idea what you are trying to achieve, either from the code or your description
    i do not know which which variables are your arrays (except i assume that runarray is your 1d array), or what you are using the 2 and 3 d arrays for
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    34

    Re: Counting

    Basically, my issue is this.

    I'm trying to make it so currentrun registered the spot it is in in an array.

    Then I want it go through the array, and once it notices that currentrun is the same as runbox.text (which is a drop down combolist that you need to pick something from), then it transfers the information to deletion run for the purpose of removing it from a written section.


    More or less my issue is I cannot have currentrun stay a proper integer while refering it to another variable, yet the moment I make it into a cell the entire system works.

    EX: CurrentRun = 5, cell A5 = 5, the next time I call it I can reference my next array to position 5.

    If I do this with CurrentRun = 5, deletionrun = 5 and then reference my array(currentrun) to deletion run's position = error.

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Counting

    where is deletionrun defined?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    34

    Re: Counting

    Quote Originally Posted by westconn1 View Post
    where is deletionrun defined?
    At the top of my worksheet. All of these are dimmed at the top of my work sheet, deletionrun being a long. Also tried moving it to int.

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