+ Reply to Thread
Results 1 to 3 of 3

Help With - Compile Error: Sub or Function Not Defined

  1. #1
    MWS
    Guest

    Help With - Compile Error: Sub or Function Not Defined

    Hello, I'm receiving the following error, in the code listed below (I input
    asterisks at the error point):

    ERROR:
    Compile Error: Sub or Function Not Defined


    Private Sub CommandButton1_Click()
    Dim Lrow As Long
    Dim CalcMode As Long
    Dim ViewMode As Long
    Dim StartRow As Long
    Dim EndRow As Long

    **************error here **********

    With Application
    CalcMode = .Calculation
    .Calculation = xlCalculationManual
    .ScreenUpdating = False
    End With

    ViewMode = ActiveWindow.View
    ActiveWindow.View = xlNormalView

    With ActiveSheet
    .DisplayPageBreaks = False
    StartRow = 1
    EndRow = 100

    For Lrow = EndRow To StartRow Step -1

    If IsError(.Cells(Lrow, "A").Value) Then
    'Do nothing, This avoid a error if there is a error in the
    cell

    ElseIf .Cells(Lrow, "A").Value = "APPLE" Then .Rows(Lrow).Delete
    'This will delete each row with the Value "ron" in Column A,
    case sensitive.

    End If
    Next
    End With

    ActiveWindow.View = ViewMode
    With Application
    .ScreenUpdating = True
    .Calculation = CalcMode
    End With

    End Sub

    Can anyone tell me how to correct the situation?

    Any and All Help Is Appreciated - Thank You



  2. #2
    Jim Thomlinson
    Guest

    RE: Help With - Compile Error: Sub or Function Not Defined

    It compiles for me...
    --
    HTH...

    Jim Thomlinson


    "MWS" wrote:

    > Hello, I'm receiving the following error, in the code listed below (I input
    > asterisks at the error point):
    >
    > ERROR:
    > Compile Error: Sub or Function Not Defined
    >
    >
    > Private Sub CommandButton1_Click()
    > Dim Lrow As Long
    > Dim CalcMode As Long
    > Dim ViewMode As Long
    > Dim StartRow As Long
    > Dim EndRow As Long
    >
    > **************error here **********
    >
    > With Application
    > CalcMode = .Calculation
    > .Calculation = xlCalculationManual
    > .ScreenUpdating = False
    > End With
    >
    > ViewMode = ActiveWindow.View
    > ActiveWindow.View = xlNormalView
    >
    > With ActiveSheet
    > .DisplayPageBreaks = False
    > StartRow = 1
    > EndRow = 100
    >
    > For Lrow = EndRow To StartRow Step -1
    >
    > If IsError(.Cells(Lrow, "A").Value) Then
    > 'Do nothing, This avoid a error if there is a error in the
    > cell
    >
    > ElseIf .Cells(Lrow, "A").Value = "APPLE" Then .Rows(Lrow).Delete
    > 'This will delete each row with the Value "ron" in Column A,
    > case sensitive.
    >
    > End If
    > Next
    > End With
    >
    > ActiveWindow.View = ViewMode
    > With Application
    > .ScreenUpdating = True
    > .Calculation = CalcMode
    > End With
    >
    > End Sub
    >
    > Can anyone tell me how to correct the situation?
    >
    > Any and All Help Is Appreciated - Thank You
    >
    >


  3. #3
    Dave Peterson
    Guest

    Re: Help With - Compile Error: Sub or Function Not Defined

    I can't tell if that mean's you're getting an error on the "Dim Endrow" line or
    the "With application" line--or the "empty" lines in between.

    I'd try deleting that line (or that group of lines) and retyping them.

    (Maybe there's an invalid (but hidden) character in that area.)



    MWS wrote:
    >
    > Hello, I'm receiving the following error, in the code listed below (I input
    > asterisks at the error point):
    >
    > ERROR:
    > Compile Error: Sub or Function Not Defined
    >
    > Private Sub CommandButton1_Click()
    > Dim Lrow As Long
    > Dim CalcMode As Long
    > Dim ViewMode As Long
    > Dim StartRow As Long
    > Dim EndRow As Long
    >
    > **************error here **********
    >
    > With Application
    > CalcMode = .Calculation
    > .Calculation = xlCalculationManual
    > .ScreenUpdating = False
    > End With
    >
    > ViewMode = ActiveWindow.View
    > ActiveWindow.View = xlNormalView
    >
    > With ActiveSheet
    > .DisplayPageBreaks = False
    > StartRow = 1
    > EndRow = 100
    >
    > For Lrow = EndRow To StartRow Step -1
    >
    > If IsError(.Cells(Lrow, "A").Value) Then
    > 'Do nothing, This avoid a error if there is a error in the
    > cell
    >
    > ElseIf .Cells(Lrow, "A").Value = "APPLE" Then .Rows(Lrow).Delete
    > 'This will delete each row with the Value "ron" in Column A,
    > case sensitive.
    >
    > End If
    > Next
    > End With
    >
    > ActiveWindow.View = ViewMode
    > With Application
    > .ScreenUpdating = True
    > .Calculation = CalcMode
    > End With
    >
    > End Sub
    >
    > Can anyone tell me how to correct the situation?
    >
    > Any and All Help Is Appreciated - Thank You


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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