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 VBA - Object Variable or With Block not set

To all -

I get the error in the subject line when I try to reset the variabl
"sAddress" at the end of the loop. I think it has something to do wit
the loop but I am not sure being this is my first Excel VBA Program.
Of Course this is only a portion of the entire code.

The data I search through is set up thusly

A Name

Various Dates

"Agent"

The data repeats itself with there being multiple instances of the sam
name. Between each date is a set of data. I am attempting to searc
through the sheet from top to bottom for each instance of the name an
get certain data from each instance. The data is always in this orde
and the string "Agent" is at the end of the data for each Name. I ge
the address of the current instance of Name and use it as the rang
between it and the end of the sheet "sSklstEnd" to search for the th
string "Agent". I use the address of agent to form a range between th
Name address and the "Agent" address to search for a given date. I
the date is not present, I extract other needed data and then I attemp
to find the next instance of the Name to go through the previou
process. I am attempting to terminate the loop when the given rang
does not yeild another instance of the Name.

If more info is needed pls let me know. Thanks.


Case Is 1
sAddress = Range("A1:"
sSklstEnd).Find(sNameOnRpt).Address
iLoopCnt = 1
Do
sAgentAddress = Range(sAddress & ":"
sSklstEnd).Find("Agent").Address
If Not Range(sAddress & ":"
sAgentAddress).Find(sDate) Is Nothing Then
Call sCall_Data(iRowCnt1, sNameOnRpt, sSklstEnd
sDNEnd, False, iFreq, iLoopCnt)
End If
Call sCall_Data(iRowCnt1, sNameOnRpt, sSklstEnd
sDNEnd, True, iFreq, iLoopCnt)
sAddress = Range(sAgentAddress & ":"
sSklstEnd).Find(sNameOnRpt).Address
iLoopCnt = iLoopCnt + 1
Loop While Not Range(sAgentAddress & ":"
sSklstEnd).Find(sNameOnRpt) Is Nothing
End Selec

--
Message posted from http://www.ExcelForum.com

 
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
object variable or with block variable not set Diego Excel Discussion (Misc queries) 1 August 9th 05 02:46 PM
Pivot Table - Object variable or with block variable not set? George Nicholson[_2_] Excel Programming 1 April 16th 04 09:12 PM
Error 91 - Object variable with block variable not set Jim[_35_] Excel Programming 2 November 27th 03 03:34 AM
Object Variable or With Block variable not set? Chris M.[_3_] Excel Programming 3 August 26th 03 04:30 PM


All times are GMT +1. The time now is 08:12 AM.

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"