Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Double search

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
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
Functions (search within search result) reply to this please Nick Excel Worksheet Functions 1 February 17th 09 03:57 AM
double axis, double problem (i hope only to me) kitcho Charts and Charting in Excel 1 December 30th 06 12:52 AM
How do I search excel spreadsheets using multiple search criteria. Kasper Excel Worksheet Functions 4 December 15th 05 12:26 AM
I cant do a search on this forum. Everytime I search, it comes up with zero results viswanthank Excel Programming 3 June 10th 05 09:15 AM
Create a search Field within a worksheet to search command buttons Ed P[_2_] Excel Programming 1 December 14th 04 08:04 PM


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