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: 82
Default Problem with Find method

I have a function in a duty roster spreadsheet which uses the find method to
find the word "Holiday" and determine who should pull duty on that day. Code
is below.

It seems to work ok until it goes on to the Set d= .FindNext(d) line. Then
I get an Object Variable or With Block Variable Not Set error.

One other called function (Step_2) uses the Find method. Would this be
re-setting the With block? How can I prevent this, or get around it? Should
I be using subs instead of functions?

There are three worksheets, the Master, a staff sheet, and a sheet that has
everyone's vacation days.
code below.
--
TIA

JonR
-------------------------------------------------------------------------------------
Function Assign_Holiday()

Worksheets("DCSIS Master").Activate

Cells(1, 3).Activate

inX1 = ActiveCell.End(xlDown).Row 'finds the first empty slot inthe duty
roster,

'after the first empty slot, first holidays are populated, the weekends,
then the rest
'the "weekend" code is suffering the same problem

With Worksheets("DCSIS Master").Range(Cells(inX1, 2), Cells(inEnd, 2))
Set d = .Find("HOLIDAY", LookIn:=xlValues)
If Not d Is Nothing Then
firsthAddress = d.Address
Do
blHoliday = True
inRow = d.Row

dtDate = Cells(inRow, 1).Value

If Cells(inRow - 1, 2).Value = "WEEKEND" Then ' check for
weekend holiday

blWeekend = True

End If

Do Until blAvail = True

Step_2 'looks for the next available person

Loop

Step_3 ' populates the duty roster

blAvail = False

Set d = .FindNext(d)

Loop While Not d Is Nothing And d.Address < firsthAddress

End If
End With
End Function
--------------------------------------------------------------------------------------------

 
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
Find Method problem in Excel VBA.... Irmann Excel Worksheet Functions 7 March 10th 08 03:49 AM
Problem with Find method IanC Excel Programming 7 September 29th 06 04:34 PM
Problem with Find Method Edward Ulle Excel Programming 4 November 22nd 05 05:00 PM
Problem with the FIND method looking for dates. jase[_2_] Excel Programming 2 November 14th 05 01:30 PM
Problem with find method Ralph Heidecke[_2_] Excel Programming 3 April 18th 05 08:07 PM


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