Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MWS MWS is offline
external usenet poster
 
Posts: 53
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Visual Basic: Compile error: Sum or Function not defined Dmitry Excel Worksheet Functions 12 April 3rd 06 07:28 AM
"Compile error: sub or function not defined" Joe Excel Discussion (Misc queries) 4 January 30th 06 08:19 PM
VBAProject name compile error, not defined at compile time Matthew Dodds Excel Programming 1 December 13th 05 07:17 PM
Variable not defined compile error Phil Hageman[_4_] Excel Programming 4 June 17th 05 01:52 PM
Compile error, variable not defined davegb Excel Programming 5 May 19th 05 04:41 PM


All times are GMT +1. The time now is 11:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"