Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default 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
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 part text, replace all text anduare2 Excel Discussion (Misc queries) 2 May 26th 09 07:43 PM
vlookup to find match only part of a text value David Excel Discussion (Misc queries) 4 August 29th 08 02:35 PM
find text in cell and replace it with part of the text in that ce. jules Excel Discussion (Misc queries) 3 May 3rd 07 10:18 AM
Find and replace part of a text string [email protected] Excel Discussion (Misc queries) 2 July 10th 06 10:34 PM
Find part of text in column or array Pasmatos Excel Discussion (Misc queries) 0 November 8th 05 10:34 AM


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