Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to run 2 searches in one sub. Search 1 is looking for a blank cell, if
found then in that same row but column A - that number must then be searched threw all my sheets. If all is found then it should return to the first search and search the next blank cell. I have managed to create most of the code but my code has this error. : Run time error 91 - object variable or with block variable not set. The code runs ok for the first search but then my variable c is set to "nothing" This is my code: Sub find_2(ByVal g As Integer, ByVal d As Integer) A = 1 Do ActiveWorkbook.Worksheets(A).Activate With Worksheets(A).Range("i1:i500") Set c = .find("", LookIn:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do g = (c.Offset(0, -8)) Set c = .FindNext(c) d = d + 1 j = 1 Do ActiveWorkbook.Worksheets(j).Activate With Worksheets(j).Range("a3:a500") Set r = Columns("A").find(What:=g) If Not r Is Nothing Then End If End With j = j + 1 Loop Until j = 12 Loop While Not c Is Nothing And c.Address < firstAddress End If End With A = A + 1 Loop Until A = 12 End Sub Any help will be appreciated |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Functions (search within search result) reply to this please | Excel Worksheet Functions | |||
double axis, double problem (i hope only to me) | Charts and Charting in Excel | |||
How do I search excel spreadsheets using multiple search criteria. | Excel Worksheet Functions | |||
I cant do a search on this forum. Everytime I search, it comes up with zero results | Excel Programming | |||
Create a search Field within a worksheet to search command buttons | Excel Programming |