+ Reply to Thread
Results 1 to 3 of 3

Compile error 1004

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Compile error 1004

    Hi friends,
    I want to filter the dates by month no matter what is the day or year. In short I want to filter the dates monthwise ignoring the year and date. The code is giving compile error 1004 autofilter method fail.
    I want to create a list of member's birthdays in a particular month.

    Please suggest me a correction.

    Thanking you in anticipation.

    Sincerely,

    Mukesh
    Attached Files Attached Files

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

    Re: Compile error 1004

    I think for your purpose, loop might be a better way to go.

    Sub birthdaymember_V2()
    Dim Filtermonth As Integer
    Dim LR As Long, i As Long
    
    On Error Resume Next
    Filtermonth = InputBox("enter month to filter")
    
    With ThisWorkbook.Worksheets("Personal")
    LR = .Cells(Rows.Count, 2).End(xlUp).Row
    
        .Cells.EntireRow.Hidden = False
        For i = LR To 9 Step -1
            If Month(.Cells(i, "O").Value) <> Filtermonth Then
                .Rows(i).Hidden = True
            End If
        Next i
    End With
    
    Exit Sub
    
    End Sub
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Compile error 1004

    Hi JieJenn,
    Thank you. The macro is not giving the output in another workbook. It hiddens the data from the personal sheet after running. If I insert the code in module it gives a error require variable or procedure. Please guide me.

    sincerely,

    Mukesh

+ 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. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  2. [SOLVED] Compile Error in Hidden Module and Compile Error: Can't find project or library
    By Taislin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2013, 07:03 PM
  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. compile error: compile error expected
    By odeno in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2008, 04:30 PM
  5. [SOLVED] VBAProject name compile error, not defined at compile time
    By Matthew Dodds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-13-2005, 03:20 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