Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Text or Part Of Text
Hi there,
Could someone tell me the VBA code to bring either bring up the FIND menu or an input box for someone to type in a word or part of a word so a list comes up of the cell reference. Many thanks. Kind Regards Kevin |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Text or Part Of Text
Tools / Macros / Record Macro - Edit / Find - Stop recording - Examine code
Example Sub DeleteRowsContaining() Dim R As Long Dim Ans As String Dim c As Range Dim lrow As Long Ans = InputBox("What string do you want rows to be deleted if they contain it?") Application.ScreenUpdating = False lrow = ActiveSheet.UsedRange.Row - 1 + _ ActiveSheet.UsedRange.Rows.Count For R = lrow To 1 Step -1 With Cells(R, 1) Set c = .find(Ans, LookIn:=xlValues) If Not c Is Nothing Then .EntireRow.Delete End If End With Next R Application.ScreenUpdating = True End Sub -- Regards Ken....................... Microsoft MVP - Excel Sys Spec - Win XP Pro / XL 97/00/02/03 ---------------------------------------------------------------------------- It's easier to beg forgiveness than ask permission :-) ---------------------------------------------------------------------------- "kevin" wrote in message ... Hi there, Could someone tell me the VBA code to bring either bring up the FIND menu or an input box for someone to type in a word or part of a word so a list comes up of the cell reference. Many thanks. Kind Regards Kevin |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Text or Part Of Text
Hi Ken,
Thanks but I just want to find the text not delete it. Can you help. many thanks. kevin. "Ken Wright" wrote: Tools / Macros / Record Macro - Edit / Find - Stop recording - Examine code Example Sub DeleteRowsContaining() Dim R As Long Dim Ans As String Dim c As Range Dim lrow As Long Ans = InputBox("What string do you want rows to be deleted if they contain it?") Application.ScreenUpdating = False lrow = ActiveSheet.UsedRange.Row - 1 + _ ActiveSheet.UsedRange.Rows.Count For R = lrow To 1 Step -1 With Cells(R, 1) Set c = .find(Ans, LookIn:=xlValues) If Not c Is Nothing Then .EntireRow.Delete End If End With Next R Application.ScreenUpdating = True End Sub -- Regards Ken....................... Microsoft MVP - Excel Sys Spec - Win XP Pro / XL 97/00/02/03 ---------------------------------------------------------------------------- It's easier to beg forgiveness than ask permission :-) ---------------------------------------------------------------------------- "kevin" wrote in message ... Hi there, Could someone tell me the VBA code to bring either bring up the FIND menu or an input box for someone to type in a word or part of a word so a list comes up of the cell reference. Many thanks. Kind Regards Kevin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
find part text, replace all text | Excel Discussion (Misc queries) | |||
vlookup to find match only part of a text value | Excel Discussion (Misc queries) | |||
find text in cell and replace it with part of the text in that ce. | Excel Discussion (Misc queries) | |||
Find and replace part of a text string | Excel Discussion (Misc queries) | |||
Find part of text in column or array | Excel Discussion (Misc queries) |