Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Find text from range and delete row

Hi all,
I have a range on sheet1 ("A12:A19"). I need to be able to look at that list
and if any name from that list is found on sheet2 ("J3:J400") then delete the
entire row that it is found in.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Find text from range and delete row

Tom,

Right click sheet 1 tab, view code and paste this in and ruen it:-

Sub stance()
Dim MyRange As Range
Set MyRange = Sheets("Sheet2").Range("J3:J400")
For x = 19 To 12 Step -1
myvalue = Cells(x, 1).Value
For Each c In MyRange
If myvalue = c.Value Then
Rows(x).EntireRow.Delete
Exit For
End If
Next
Next
End Sub

Mike

"Tom" wrote:

Hi all,
I have a range on sheet1 ("A12:A19"). I need to be able to look at that list
and if any name from that list is found on sheet2 ("J3:J400") then delete the
entire row that it is found in.

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Find text from range and delete row

Mike,
Thanks for the reply! Your code is actually working backwards to what I was
actually needing - maybe I didn't explain the situation right? The range of
names on Sheet1 is what to look for on sheet2. It is the found matches (rows)
on sheet2 that I need to be deleted. This code actually deletes my list on
sheet1. It works...just opposite of what I need.
Look at name on sheet1 ("A12:A19")
Find the match on sheet2 ("J3:J400")
Delete the row on sheet2 if any of the names matches anything in Sheet1
A12:A19

Sorry if I didn't explain myself right the first time around!

Thanks!


"Mike H" wrote:

Tom,

Right click sheet 1 tab, view code and paste this in and ruen it:-

Sub stance()
Dim MyRange As Range
Set MyRange = Sheets("Sheet2").Range("J3:J400")
For x = 19 To 12 Step -1
myvalue = Cells(x, 1).Value
For Each c In MyRange
If myvalue = c.Value Then
Rows(x).EntireRow.Delete
Exit For
End If
Next
Next
End Sub

Mike

"Tom" wrote:

Hi all,
I have a range on sheet1 ("A12:A19"). I need to be able to look at that list
and if any name from that list is found on sheet2 ("J3:J400") then delete the
entire row that it is found in.

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Find text from range and delete row

Tom,

Converted to work the other way around which now means you paste it into
sheet 2.

Sub stance()
Dim MyRange As Range
Set MyRange = Sheets("Sheet1").Range("A12:A19")
For x = 400 To 3 Step -1
myvalue = Cells(x, 10).Value
For Each c In MyRange
If myvalue = c.Value Then
Rows(x).EntireRow.Delete
Exit For
End If
Next
Next
End Sub

Mike

"Tom" wrote:

Mike,
Thanks for the reply! Your code is actually working backwards to what I was
actually needing - maybe I didn't explain the situation right? The range of
names on Sheet1 is what to look for on sheet2. It is the found matches (rows)
on sheet2 that I need to be deleted. This code actually deletes my list on
sheet1. It works...just opposite of what I need.
Look at name on sheet1 ("A12:A19")
Find the match on sheet2 ("J3:J400")
Delete the row on sheet2 if any of the names matches anything in Sheet1
A12:A19

Sorry if I didn't explain myself right the first time around!

Thanks!


"Mike H" wrote:

Tom,

Right click sheet 1 tab, view code and paste this in and ruen it:-

Sub stance()
Dim MyRange As Range
Set MyRange = Sheets("Sheet2").Range("J3:J400")
For x = 19 To 12 Step -1
myvalue = Cells(x, 1).Value
For Each c In MyRange
If myvalue = c.Value Then
Rows(x).EntireRow.Delete
Exit For
End If
Next
Next
End Sub

Mike

"Tom" wrote:

Hi all,
I have a range on sheet1 ("A12:A19"). I need to be able to look at that list
and if any name from that list is found on sheet2 ("J3:J400") then delete the
entire row that it is found in.

Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Find text from range and delete row

That did it....thanks Mike, your help is appreciated!

"Mike H" wrote:

Tom,

Converted to work the other way around which now means you paste it into
sheet 2.

Sub stance()
Dim MyRange As Range
Set MyRange = Sheets("Sheet1").Range("A12:A19")
For x = 400 To 3 Step -1
myvalue = Cells(x, 10).Value
For Each c In MyRange
If myvalue = c.Value Then
Rows(x).EntireRow.Delete
Exit For
End If
Next
Next
End Sub

Mike

"Tom" wrote:

Mike,
Thanks for the reply! Your code is actually working backwards to what I was
actually needing - maybe I didn't explain the situation right? The range of
names on Sheet1 is what to look for on sheet2. It is the found matches (rows)
on sheet2 that I need to be deleted. This code actually deletes my list on
sheet1. It works...just opposite of what I need.
Look at name on sheet1 ("A12:A19")
Find the match on sheet2 ("J3:J400")
Delete the row on sheet2 if any of the names matches anything in Sheet1
A12:A19

Sorry if I didn't explain myself right the first time around!

Thanks!


"Mike H" wrote:

Tom,

Right click sheet 1 tab, view code and paste this in and ruen it:-

Sub stance()
Dim MyRange As Range
Set MyRange = Sheets("Sheet2").Range("J3:J400")
For x = 19 To 12 Step -1
myvalue = Cells(x, 1).Value
For Each c In MyRange
If myvalue = c.Value Then
Rows(x).EntireRow.Delete
Exit For
End If
Next
Next
End Sub

Mike

"Tom" wrote:

Hi all,
I have a range on sheet1 ("A12:A19"). I need to be able to look at that list
and if any name from that list is found on sheet2 ("J3:J400") then delete the
entire row that it is found in.

Thanks!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Find text from range and delete row

Your welcome and thanks for the feedback

"Tom" wrote:

That did it....thanks Mike, your help is appreciated!

"Mike H" wrote:

Tom,

Converted to work the other way around which now means you paste it into
sheet 2.

Sub stance()
Dim MyRange As Range
Set MyRange = Sheets("Sheet1").Range("A12:A19")
For x = 400 To 3 Step -1
myvalue = Cells(x, 10).Value
For Each c In MyRange
If myvalue = c.Value Then
Rows(x).EntireRow.Delete
Exit For
End If
Next
Next
End Sub

Mike

"Tom" wrote:

Mike,
Thanks for the reply! Your code is actually working backwards to what I was
actually needing - maybe I didn't explain the situation right? The range of
names on Sheet1 is what to look for on sheet2. It is the found matches (rows)
on sheet2 that I need to be deleted. This code actually deletes my list on
sheet1. It works...just opposite of what I need.
Look at name on sheet1 ("A12:A19")
Find the match on sheet2 ("J3:J400")
Delete the row on sheet2 if any of the names matches anything in Sheet1
A12:A19

Sorry if I didn't explain myself right the first time around!

Thanks!


"Mike H" wrote:

Tom,

Right click sheet 1 tab, view code and paste this in and ruen it:-

Sub stance()
Dim MyRange As Range
Set MyRange = Sheets("Sheet2").Range("J3:J400")
For x = 19 To 12 Step -1
myvalue = Cells(x, 1).Value
For Each c In MyRange
If myvalue = c.Value Then
Rows(x).EntireRow.Delete
Exit For
End If
Next
Next
End Sub

Mike

"Tom" wrote:

Hi all,
I have a range on sheet1 ("A12:A19"). I need to be able to look at that list
and if any name from that list is found on sheet2 ("J3:J400") then delete the
entire row that it is found in.

Thanks!

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
find text and delete rows. John Excel Discussion (Misc queries) 5 December 12th 07 04:25 AM
Find and Replace - delete the remainder of the text in the cell after my Find [email protected] Excel Programming 4 August 4th 07 03:39 AM
Find and Delete Row from Range Steve Haack Excel Programming 4 January 28th 07 07:16 PM
find text delete row okrob Excel Programming 5 January 17th 07 06:46 PM
find and delete text, find a 10-digit number and put it in a textbox Paul Excel Programming 3 November 16th 04 04:21 PM


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