Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default union/disunion?

I have a macro that searches a spreadsheet for certain cells that contains
certain values. In some cases I need to specify that I olny want to search
parts of the spreadsheet. For example I first search for the word "IMM" and
then I search for the word "FUTURE". I then want to search to rest of the
spreadsheet for the word "DATE" i.e. search all rows except for the rows that
conatins IMM and FUTURE. I know that there is a union thing in Excel but is
there a thing such as disunion? My code looks like:

Dim searchRange As Range
Set searchRange = Range(Cells(secID.Row, 1), Cells(secID.Row, 100))
Set secID = Worksheets("Sheet").Range(Cells(segment.Offset(i, j).Row,
1), Cells(3000, 100)).Find("Date", LookIn:=xlValues)

I need to handle this varibly because it changes all the time. Please help
me out if you can! Thank you very much!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default union/disunion?

Arne,

You would need to make up a range that includes all the IMM and FUTURE result - using Union, let's
call the range rInF- and then when your find DATE, you would need to make sure that

If Intersect(rInF.EntireRow,secID.EntireRow) Is Nothing Then
'They don't share a row
Else
'They do share a row
End If

HTH,
Bernie
MS Excel MVP


"Arne Hegefors" wrote in message
...
I have a macro that searches a spreadsheet for certain cells that contains
certain values. In some cases I need to specify that I olny want to search
parts of the spreadsheet. For example I first search for the word "IMM" and
then I search for the word "FUTURE". I then want to search to rest of the
spreadsheet for the word "DATE" i.e. search all rows except for the rows that
conatins IMM and FUTURE. I know that there is a union thing in Excel but is
there a thing such as disunion? My code looks like:

Dim searchRange As Range
Set searchRange = Range(Cells(secID.Row, 1), Cells(secID.Row, 100))
Set secID = Worksheets("Sheet").Range(Cells(segment.Offset(i, j).Row,
1), Cells(3000, 100)).Find("Date", LookIn:=xlValues)

I need to handle this varibly because it changes all the time. Please help
me out if you can! Thank you very much!!



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
union problem tom taol Excel Programming 2 February 1st 05 08:43 AM
Help w/ Union Queries Jenn Excel Discussion (Misc queries) 1 January 12th 05 01:07 AM
Union question ToddG Excel Programming 3 June 25th 04 07:57 PM
Union only works for sometimes. Shu Excel Programming 3 December 14th 03 01:25 PM
VBA union of two ranges s[_2_] Excel Programming 1 August 21st 03 02:18 AM


All times are GMT +1. The time now is 08:33 PM.

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"