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: 343
Default Object Variable error

I use the following code below to populate the current cell on the January
worksheet (there is a worksheet for each month, and each month has to have
all the names that appear on the ParaTransit Names worksheet) with the name
that is entered in the referenced cell on the ParaTransit Names worksheet:

=IF('ParaTransit Names'!B15"",'ParaTransit Names'!B15,"")


I then use the following code to place the name contained in the active cell
on the January worksheet in the TextBox of the UserForm:


Private Sub UserForm_Initialize()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

'Places date in box at top of userform

TextBox1.Text = rng(1, 2).Text

End Sub


What I was hoping for, is that when I ran the code below it would search out
and select the cell matching the TextBox value on the ParaTransit Names
worksheet. What I get is an Error Msg "object variable or With block
variable not set". Any guidance here?




Private Sub CommandButton1_Click()

With ActiveWorkbook.Worksheets("ParaTransit Names")

Cells.Find(What:=Me.TextBox1.Text, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate

End With

End Sub

 
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
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
Runtime Error 91 Object variable or With block variable not set. Tim Excel Programming 9 June 5th 08 10:03 PM
Run-Time error '91': Object variable of With block variable not set jammin1911 Excel Programming 3 June 6th 06 06:36 PM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 05:50 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"