Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MJ MJ is offline
external usenet poster
 
Posts: 3
Default offset and address?

Hi,

I do a match on something and it returns the offset. Is there a way
to determine the exact address so that I can delete that row?
Thanks!!!

Here is the code:

Sub MatchData()

Dim MyList1Range As Range
Dim MyList2Range As Range
Dim res As Variant

ThisWorkbook.Sheets("Sheet2").Activate
Range("A2").CurrentRegion.Select
MaxRow1 = Selection.Rows.Count
Set MyList1Range = Range("a2:A" & MaxRow1)

ThisWorkbook.Sheets("Sheet1").Activate
Range("A2").CurrentRegion.Select
MaxRow2 = Selection.Rows.Count
Set MyList2Range = Range("a2:A" & MaxRow2)


Range("A2").Select

Do While ActiveCell().Value < "" 'From Sheet1

res = Application.Match(ActiveCell().Value, MyList1Range, 0) 'match
from Sheet2

If IsError(res) Then
'there is no match - append the cell value into Sheet2 - still need
to do

Else
'there is a match - delete the row because the id was already on
Sheet2
'this returns the offset
MsgBox "Match offset into range is: " & res

End If

ActiveCell().Offset(1, 0).Select
Loop
End Sub
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
Sum - Offset - Address problem. DaveO Excel Worksheet Functions 1 February 22nd 07 03:59 PM
???? =offset(ADDRESS(ROW(),COLUMN()),1,1,1,1) Creator Excel Worksheet Functions 5 February 17th 06 02:16 PM
SUM, OFFSET and CELL("address") Quizarate Excel Worksheet Functions 7 August 17th 05 07:18 PM
Offset with Cell("address") James W. Excel Worksheet Functions 1 December 7th 04 08:39 PM
Using Offset on Cell Address kfh105 Excel Programming 3 April 6th 04 08:35 PM


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