Autofilter and return cell values using VBA

  • Some of the text has obviously been transposed, this is what that section should look like:


  • Here is your file with new code and a couple of other changes.


    I made Dashboard C4 to C13 named ranges (simplifies the code a bit) and you will note values in K2 to K4, these are the integers that NUMBER must start with for each given PEG (PEGs are in J2 to J4). You can change the font colour of K2 to K4 to hide the text. This is to check that a valid NUMBER has been entered for the entered PEG.


    Further checks for other validities can be incorporated into the main code.


    The NUMBER check code is a Worksheet_Change Event Code in the Dasboard Sheet Module, it is fired when a new NUMBER is entered. The code is:

    The code assigned to the button is still in Module 1, and is

    Let me know if you have any issues.

  • You're welcome, hope you can transfer everything to you actual workbook ok :)

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • I've just noticed that if you are using the code in my examples, you need to change this part in the Add sub from:


    Code
        If Not FindInRange(rRng, TTime, rFind) Then lTTime = 0


    To:


    Code
    If Not FindInRange(rRng, TTime, rFind) Then
      lTTime = 0
    Else
      lTTime = rFind.Column
    End If


    Otherwise Transit Time will never get updated even when it exists in the LEG sheet

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!