LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default pesty "Compile Error!"




I need serious help, I have a small form with a series of textboxes
comboboxes and optionbuttons. What it basically does is th
following..., the first textbox searches number string... for som
reason "Trim" does not seen to work, then "Formatting number t
"00000"" does not seen to work either and finally "Response
MsgBox....." stops everything. I get the following in all erro
messages:

Compile error:
Can't Find Project or library

Can someone please help me? You are welcome to rewrite my code and mak
it better and tider. I'm not the best code writer... just been learnin
a bit here and there in this forum.

The following is the code in the form:

'...finds the last ocurrence of the search string
Private Sub TextBox101_Change()
Dim FindString As String
Dim Rng As Range

FindString = TextBox101.Text

first error pops up = If Trim(FindString) < "" Then

Set Rng = Range("C:C").Find(What:=FindString, _
After:=Range("C1"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)

If Not Rng Is Nothing Then Application.Goto Rng, True

End If

On Error GoTo errhandler

TextBox103.Value = Selection.Offset(0, 1).Text
TextBox102.Value = Selection.Offset(0, -2).Text

errhandler:
If Err.Number = 1004 Then
Err.Clear

End If

End Sub


'forces ref # to accept numbers only
Private Sub TextBox101_KeyPress(ByVal KeyAscii A
MSForms.ReturnInteger)

If KeyAscii < 48 Or KeyAscii 57 Then
KeyAscii = 0
Beep
Else
End If

End Sub
'formats ref # into 5 digit #
Private Sub TextBox101_Exit(ByVal Cancel As MSForms.ReturnBoolean)

2nd error pops up =TextBox101.Value = Format(TextBox101.Value

"00000")

End Sub
'...if driver changes, vehicle number is cleared and code waits fo
next selection
Private Sub ComboBox101_Change()
On Error Resume Next

TextBox104.Text = ComboBox101.Column(1)


End Sub

'...Ok button
Private Sub CommandButton103_Click()
On Error GoTo errhandler
'If value if found next to time string, code prohibits Offset method

If Selection.Offset(0, 9).Value = "" Then
'inserts content of text/combobx in sequence based on time strin
location
Selection.Offset(0, 9).Value = ComboBox101.Text
Selection.Offset(0, 10).Value = TextBox104.Text
Selection.Offset(0, 12).Value = ComboBox103.Text

If OptionButton101.Value = True Then
Selection.Offset(0, 11).Value = "Completed"
End If

If OptionButton102.Value = True Then
Selection.Offset(0, 11).Value = "Rescheduled"
End If

If OptionButton103.Value = True Then
Selection.Offset(0, 11).Value = "Cancelled"
End If

MsgBox "Record Status Completed!"

last error pops up = response = MsgBox("Continue with anothe

Record?", _
vbYesNo)
'When record is added code clears userform
If response = vbYes Then
TextBox101.Text = ""
TextBox102.Text = ""
TextBox103.Text = ""
TextBox104.Text = ""

ComboBox101.Text = ""
ComboBox103.Text = ""

OptionButton101.Value = False
OptionButton102.Value = False
OptionButton103.Value = False

TextBox101.SetFocus


'when "no" is selected it closes form
Else
Unload Me
End If
Else
MsgBox "Status Already Determined"
End If

If Not Rng Is Nothing Then Application.Goto Rng, True

errhandler:
If Err.Number = 91 Then
MsgBox "errors"
End If

End Sub


I know you're all busy people... but please help me, I have spent
days on this!

- Larry -
VBA Amateu

--
nrage2
-----------------------------------------------------------------------
nrage21's Profile: http://www.excelforum.com/member.php...nfo&userid=480
View this thread: http://www.excelforum.com/showthread.php?threadid=26475

 
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
Get a VB "Compile error in hidden module: DistMon" at start Dave Excel Discussion (Misc queries) 1 August 10th 09 12:19 AM
How correct (or remove) "Compile error in hidden module: DistMon" wlfoote Excel Discussion (Misc queries) 1 June 6th 09 02:57 AM
"compile error in hidden module": DISTMOD -- ideas to fix it?? Clare Excel Discussion (Misc queries) 3 May 29th 08 01:44 AM
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" QTP Professional Excel Discussion (Misc queries) 1 November 18th 05 11:47 PM
Getting "compile error" "method or data member not found" on reinstall Bp Excel Programming 1 April 23rd 04 04:42 PM


All times are GMT +1. The time now is 02:49 PM.

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

About Us

"It's about Microsoft Excel"