Msg is not declared in a Dim satement. I assume that you have Option Explicit
at the top of this code module (as you should) and that it doe not exist in
the other module where you copied it from. Change Msg to Response which is
delcared and you should be good to go. (To be technically correct Response
should be a long as MsgBox returns a long not an integer but under normal
circumsatances it makes not practical difference.)
--
HTH...
Jim Thomlinson
"Casey" wrote:
Hi,
I recently copied code out of one VBA project and pasted it into a new
project. The code still works fine in the original project, but in the
new project I get the Compile Error:Can't find project or library.
VBA help says this is due to a missing reference and direct me to
"Display the References dialog box", but I can't locate this dialog box
anywhere. Here is my code and the editor highlights "msg =" in the
code. Any help would be greatly appreciated.
Sub DeleteBlankLastRow_CheckIfBlank()
Dim Response As Integer
Dim rngEntryBottomRow As Range
On Error GoTo ws_exit
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect ("geekk")
Set rngEntryBottomRow = Range("Below_Entry_Bottom_Row").Offset(-1)
'if last detail row is blank, delete one detail row and If not
empty
' then msg box to explain error and exit sub.
If Application.WorksheetFunction.CountA(rngEntryBotto mRow) 5
Then
Msg = MsgBox("You are attempting to Delete a Row that contains
User Input. Delete Row Failed", vbOKOnly + vbCritical, "Can Not Delete
Row with Information")
If Response = 1 Or 2 Then Exit Sub
End If
If Application.WorksheetFunction.CountA(rngEntryBotto mRow) = 5
Then
With rngEntryBottomRow 'rngI
.EntireRow.Delete
End With
End If
ActiveSheet.Protect ("geekk"), DrawingObjects:=True,
Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
ws_exit:
Application.EnableEvents = True
End Sub
--
Casey
------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=395380