A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Compile error



 
 
Thread Tools Display Modes
  #1  
Old February 8th, 2009, 05:25 PM posted to microsoft.public.excel.newusers
George Gee
external usenet poster
 
Posts: 111
Default Compile error

Hi all

I've received a worksheet from a colleague, when trying to run a macro,
I get a compile error - 'Cannot find project or library'

Code stops at --- hilltest = LCase(hilltest)

with LCase highlighted.

Can anyone explain the problem? Code below

---------------------------------------------------------------------------

Sub NameSearch(xtest)
Dim myName As String
Dim i As Integer, idb As Integer, myrow As Integer
Dim hilltest As String
'Dim xtest As Integer

idb = 3688

myName = Application.InputBox("Choose a Hill: You can use * as a
wildcard", Type:=2 + 4)

If myName = "False" Then
Exit Sub
End If

If myName = "" Then
Do While myName = ""
MsgBox ("You must enter a Hill Name")
myName = Application.InputBox("Choose a Hill: You can use * as a
wildcard", Type:=2 + 4)

If myName = "False" Then
Exit Sub
End If

Loop
End If

Sheets("Hills").Select
'MsgBox myName
For i = 2 To idb
Application.ScreenUpdating = False
ActiveSheet.Cells(i, 3).Select
hilltest = ActiveSheet.Cells(i, 3).Value
hilltest = LCase(hilltest)
myName = LCase(myName)

If hilltest Like myName Then
Application.ScreenUpdating = True
myrow = i
ActiveSheet.Rows(myrow).Select
xtest = MsgBox("Is this the Hill you want?", 3, "Search Result")

If xtest = 6 Then
Exit Sub
End If
If xtest = 2 Then
Exit Sub
End If
End If

'For i = 1 To 10
'On Error GoTo CheckFiles_Err
'ActiveSheet.Cells.Find(What:=myName, After:=ActiveCell, LookIn:=xlFormulas,
LookAt:=xlWhole, _
'SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=False).Activate
'myName = InputBox("Choose a hill; * acts as a wild card, now Click
Cancel to make this selection or OK to continue looking for another hill",
"Hill Name", myName)
'If myName = "" Then
' Exit Sub
'End If
'Next i

'myName = True
'CheckFiles_Err: MsgBox "The Hill name you entered is not in the Database"

Next i

Sheets("Options").Select
MsgBox ("The Hill you entered is not in the Database")
End Sub

Many thanks
George Gee


  #2  
Old February 8th, 2009, 05:36 PM posted to microsoft.public.excel.newusers
CurlyDave
external usenet poster
 
Posts: 112
Default Compile error

Check This out
http://support.microsoft.com/default.aspx/kb/166273
  #3  
Old February 8th, 2009, 06:00 PM posted to microsoft.public.excel.newusers
George Gee
external usenet poster
 
Posts: 111
Default Compile error

CurlyDave

Thanks for the link, problem solved.

George Gee


"CurlyDave" wrote in message
...
Check This out
http://support.microsoft.com/default.aspx/kb/166273



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:04 AM.


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