Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old July 15th 09, 06:25 PM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2009
Posts: 4
Default Cell searching and delete function

What I need to figure out how to do is search through a certain group of
cells like--C1:C250, and if it matches with G2, I would like whatever "C"
cell that matches with the "G" cell deleted. I hope this makes sense. I have
no idea how to make this happen or if it is possible

Searches C1:C250 and finds match for cell G2 then deletes the "C" cell.

Any help would be wonderful.

  #2   Report Post  
Old July 15th 09, 06:33 PM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2007
Posts: 2,722
Default Cell searching and delete function

You will need to use a macro. Open the VBE (Alt+F11), Insert - Module. Paste
this in:

Sub FindAndDestory()
For Each cell In Range("C1:C250")
If cell.Value = Range("G2") Then
cell.ClearContents
End If
Next cell
End Sub

'You can then play this macro from XL, Under Tools-Macros-Maco
'Note that when you run this, it will apply to the sheet currently visible.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Dan C." wrote:

What I need to figure out how to do is search through a certain group of
cells like--C1:C250, and if it matches with G2, I would like whatever "C"
cell that matches with the "G" cell deleted. I hope this makes sense. I have
no idea how to make this happen or if it is possible

Searches C1:C250 and finds match for cell G2 then deletes the "C" cell.

Any help would be wonderful.

  #3   Report Post  
Old July 15th 09, 06:45 PM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2009
Posts: 4
Default Cell searching and delete function

How do I modify that to continue to do that down every G cell

Ex: G2 then G3 then G4 etc to like G121?

I did play around with it to try to do this on my own but I do know have the
knowledge yet or brain capacity to figure it out.

"Luke M" wrote:

You will need to use a macro. Open the VBE (Alt+F11), Insert - Module. Paste
this in:

Sub FindAndDestory()
For Each cell In Range("C1:C250")
If cell.Value = Range("G2") Then
cell.ClearContents
End If
Next cell
End Sub

'You can then play this macro from XL, Under Tools-Macros-Maco
'Note that when you run this, it will apply to the sheet currently visible.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Dan C." wrote:

What I need to figure out how to do is search through a certain group of
cells like--C1:C250, and if it matches with G2, I would like whatever "C"
cell that matches with the "G" cell deleted. I hope this makes sense. I have
no idea how to make this happen or if it is possible

Searches C1:C250 and finds match for cell G2 then deletes the "C" cell.

Any help would be wonderful.

  #4   Report Post  
Old July 15th 09, 07:21 PM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2007
Posts: 2,722
Default Cell searching and delete function

Sub FindAndDestroy()

For Each cell In Range("C1:C250")

With Range("G2:G121")
Set c = .Find(cell.Value, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
cell.ClearContents
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

Next cell
End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Dan C." wrote:

How do I modify that to continue to do that down every G cell

Ex: G2 then G3 then G4 etc to like G121?

I did play around with it to try to do this on my own but I do know have the
knowledge yet or brain capacity to figure it out.

"Luke M" wrote:

You will need to use a macro. Open the VBE (Alt+F11), Insert - Module. Paste
this in:

Sub FindAndDestory()
For Each cell In Range("C1:C250")
If cell.Value = Range("G2") Then
cell.ClearContents
End If
Next cell
End Sub

'You can then play this macro from XL, Under Tools-Macros-Maco
'Note that when you run this, it will apply to the sheet currently visible.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Dan C." wrote:

What I need to figure out how to do is search through a certain group of
cells like--C1:C250, and if it matches with G2, I would like whatever "C"
cell that matches with the "G" cell deleted. I hope this makes sense. I have
no idea how to make this happen or if it is possible

Searches C1:C250 and finds match for cell G2 then deletes the "C" cell.

Any help would be wonderful.



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
Text Searching in a Function malvis Excel Discussion (Misc queries) 3 June 23rd 09 02:23 PM
searching for a function Noha Excel Worksheet Functions 7 January 8th 09 03:45 PM
Searching specific record using VLOOKUP function. dev Excel Worksheet Functions 12 July 4th 08 11:51 PM
searching for function Adam Excel Discussion (Misc queries) 3 October 2nd 07 09:01 PM
Delete Cell Function roy.okinawa Excel Worksheet Functions 7 November 23rd 05 06:49 AM


All times are GMT +1. The time now is 02:12 AM.

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017