Results 1 to 6 of 6

Getting compile error 1004

Threaded View

  1. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Getting compile error 1004

    Maybe ...

    Private Sub Worksheet_Change(ByVal Target As Range)
      Dim cell          As Range
    
      With Target
        If .Column <> 3 Then Exit Sub
        
        On Error GoTo Oops
        Application.EnableEvents = False
    
        If .Count = 1 Then
          If IsEmpty(.Value) Then
            .EntireRow.Range("D1").Value = "L"
            .EntireRow.Range("E1:L1").ClearContents
          End If
        End If
      End With
    
      With Range("A4:A90")
        .FormulaR1C1 = "=IF(RC[2]>0,SUM(MAX(R3C:R[-1]C),1),"""")"
        .Value = .Value
      End With
    
      For Each cell In Worksheets("Semester1").Range("B10:B90").Cells
        If IsEmpty(cell.Value) Then
          cell.EntireRow.Range("C1:G1, K1:O1").Value = "L"
          cell.EntireRow.Hidden = True
        End If
      Next cell
    
      For Each cell In Worksheets("Semester2").Range("B10:B90").Cells
        If IsEmpty(cell.Value) Then
          cell.EntireRow.ClearContents
          cell.EntireRow.Hidden = True
        End If
      Next cell
    
    Done:
      Application.EnableEvents = True
      Exit Sub
    
    Oops:
      MsgBox "Oops"
      Resume Done
    End Sub
    Last edited by shg; 02-15-2015 at 03:08 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Compile error 1004
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-08-2014, 10:35 PM
  2. 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
  3. [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
  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. 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

Tags for this Thread

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