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

I am trying to use interset method to locate a cell and get the value from
that cell. My cod now is:

Dim cell1 As Range
Dim cell2 As Range
cell1 = segment.Offset(0, m).Address
cell2 = segment.Offset(i, 0).Address
Set isect = Application.Intersect(Range("cell1"), Range("cell2"))

and it does not work at all. I have to use the segment.Offset() somehow
because I use that code to find other cells like this:

Do Until segment.Offset(i, 0).Value = "Cash" Or i 5000
i = i + 1
Loop

Please help me with this code! Thanks very much in advance!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Intersect Method

if cell1 and cell2 both refer to single cells, unless they are the same
cell, there is no intersect. Intersect refers to a cell or cells that are
contained within two or more ranges.

Maybe you could better explain what you arte trying to do.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Arne Hegefors" wrote in message
...
I am trying to use interset method to locate a cell and get the value from
that cell. My cod now is:

Dim cell1 As Range
Dim cell2 As Range
cell1 = segment.Offset(0, m).Address
cell2 = segment.Offset(i, 0).Address
Set isect = Application.Intersect(Range("cell1"), Range("cell2"))

and it does not work at all. I have to use the segment.Offset() somehow
because I use that code to find other cells like this:

Do Until segment.Offset(i, 0).Value = "Cash" Or i 5000
i = i + 1
Loop

Please help me with this code! Thanks very much in advance!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Intersect Method


Arne Hegefors wrote:
I am trying to use interset method to locate a cell and get the value from
that cell. My cod now is:

Dim cell1 As Range
Dim cell2 As Range
cell1 = segment.Offset(0, m).Address
cell2 = segment.Offset(i, 0).Address
Set isect = Application.Intersect(Range("cell1"), Range("cell2"))

and it does not work at all. I have to use the segment.Offset() somehow
because I use that code to find other cells like this:

Do Until segment.Offset(i, 0).Value = "Cash" Or i 5000
i = i + 1
Loop

Please help me with this code! Thanks very much in advance!


You have dimensioned cell1 and cell2 as ranges so you should be using
Set, and not using .Address...

Set cell1 = segment.Offset(0, m)
Set cell2 = segment.Offset(i, 0)


Then for isect it should be...

Set isect = Application.Intersect(cell1,cell2)

Ken Johnson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default Intersect Method

Hi Arne,

Without knowing more :
Maybe you need to use something like
Application.Intersect(Range("cell1").entireRow, Range("cell2").entireColumn)
?
Regards
JY

"Arne Hegefors" wrote in message
...
I am trying to use interset method to locate a cell and get the value from
that cell. My cod now is:

Dim cell1 As Range
Dim cell2 As Range
cell1 = segment.Offset(0, m).Address
cell2 = segment.Offset(i, 0).Address
Set isect = Application.Intersect(Range("cell1"), Range("cell2"))

and it does not work at all. I have to use the segment.Offset() somehow
because I use that code to find other cells like this:

Do Until segment.Offset(i, 0).Value = "Cash" Or i 5000
i = i + 1
Loop

Please help me with this code! Thanks very much in advance!




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
Intersect Arne Hegefors Excel Programming 1 July 25th 06 09:38 AM
Intersect [email protected] Excel Programming 2 July 19th 06 10:41 PM
Method 'Intersect' of object '_Global' failed Josh Sale Excel Programming 3 June 17th 04 05:27 PM
Exception when uisng Intersect method Ai Excel Programming 8 May 24th 04 09:12 PM
Is there a "Non-Intersect" VBA method to remove a sub-range from a range? brettdj Excel Programming 1 December 11th 03 06:13 AM


All times are GMT +1. The time now is 11:30 AM.

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"