+ Reply to Thread
Results 1 to 8 of 8

Trying to make a filter list based on dates

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Trying to make a filter list based on dates

    The below vba code attempts to extract a smaller list from a larger list based on Maturity Dates. However, it doesn't seem to work when I copied this code into a new spreadsheet.

    The red portion is the one first highlighted by Microsoft visual basic to be erroneous. There could very well be more errors.

    Please help.
    Thank you.


    Sub maturityRange()
    Dim i, j, k As Integer


    With Sheet12
    Do While .[Maturity].Offset(i + 1, 0).Value <> ""

    If .[Maturity].Offset(i + 1, 0).Value <= .[EndDate].Value And .[Maturity].Offset(i + 1, 0).Value >= .[StartDate].Value Then
    For k = 0 To 2
    .[List].Offset(j + 1, k) = .[Description].Offset(j + 1, k).Value
    Next k
    j = j + 1
    End If
    i = i + 1
    Loop
    End With
    End Sub
    Last edited by siukingyiu; 10-09-2013 at 12:59 PM.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Not sure what the error is...

    Is there any value contained in variable i ? if i empty or a null value, VBA will give you an error.

  3. #3
    Registered User
    Join Date
    08-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Not sure what the error is...

    No Variable in i. I copied the entire code from my previous spreadsheet, and there wasnt any there either..

    Could you teach me how to add a value to i please?

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Not sure what the error is...

    Can you post your workbook?

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Not sure what the error is...

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request. (Also, include a link to your thread - copy from the adress bar)

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    08-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Not sure what the error is...

    Please find attached for the workbook
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Trying to make a filter list based on dates

    Try

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Trying to make a filter list based on dates

    Omg...it works...im so happy..im actually crying.

    Quote Originally Posted by JieJenn View Post
    Try

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Error " Run-time error '1004': application defined or object defined error
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2013, 07:26 AM
  2. Receiving following error “Complie error : syntax error” Help
    By masond3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2012, 10:19 AM
  3. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  4. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM
  5. Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1