Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Remove rows based on any selected criteria

I would to remove rows containing any data type (text,
number or date) that the user choose. i create the form
where the range and the criteria can be entered, however
in the find portion if I change find(what:"0" ... it works
fine but when I change for NewTxtRem (see code below) that
comes from the user form caption TextToRemove I get
runtime error 438 Object doesn't support this property or
method in the line
Set rgFoundCell = RefEdit2.Find(What:=NewTxtRem,
LookAt:=xlWhole)

Can I get some help to how overcome this? THANKS A LOT

Private Sub go_Click()
' Perform the selected operation
Dim WorkRange As Range
Dim NewTxtRem As Variant
NewTxtRem = TextToRemove.Text

' Validate Range reference
If Not ValidReference(RefEdit2.Text) Then
MsgBox "Invalid range.", vbInformation
Application.ScreenUpdating = True
With RefEdit2
.SelStart = 0
.SelLength = 100
.SetFocus
End With
Exit Sub
End If

' Figure out what to do
Application.ScreenUpdating = False
Dim rgFoundCell As Range
Application.ScreenUpdating = False
Set rgFoundCell = RefEdit2.Find
(What:=NewTxtRem, LookAt:=xlWhole)
Do Until rgFoundCell Is Nothing
rgFoundCell.EntireRow.Delete
Set rgFoundCell = NewTxtRem.FindNext
Loop
Application.ScreenUpdating = True
Unload Me
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
Make copy of workbook based on selected criteria Anthony[_5_] Excel Worksheet Functions 3 March 30th 10 10:57 PM
Counting unique dates based on selected criteria in a list orchid11652 Excel Worksheet Functions 1 July 25th 07 12:08 AM
How do I Remove Rows that match a criteria Mahesh Excel Discussion (Misc queries) 3 April 30th 07 10:58 PM
Suming selected cells based on two criteria Gerard Excel Worksheet Functions 3 August 9th 06 11:45 AM
Create a report with selected rows based on the content in a cell ThirdTim New Users to Excel 1 May 5th 05 05:18 PM


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