Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime Error '91' Object variable or With block variable not set | Excel Discussion (Misc queries) | |||
object variable or with block variable not set | Excel Discussion (Misc queries) | |||
Pivot Table - Object variable or with block variable not set? | Excel Programming | |||
Error 91 - Object variable with block variable not set | Excel Programming | |||
Object Variable or With Block variable not set? | Excel Programming |