LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default combining multiple find/replace subs

Hello

I have about 7 or 8 subs for finding and replacing after a huge amount
of .txt files have been searched for "href." They are meant for
extracting the data that I actually need. The only thing is, is that
the report I created with them in there takes way too long, almost an
hour. Is there a way to combine these or somehow speed up their
processing speed? Here are a couple examples, they are searching
through about 45,000 rows.

Sub DeleteRowsImg()

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, 2)
Set c = .Find("img", LookIn:=xlValues)
If Not c Is Nothing Then
.EntireRow.Delete
End If
End With
Next r
Application.ScreenUpdating = True

End Sub

Sub DeleteRowsAboutus()

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, 2)
Set c = .Find("aboutus", LookIn:=xlValues)
If Not c Is Nothing Then
.EntireRow.Delete
End If
End With
Next r
Application.ScreenUpdating = True

End Sub
 
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
Multiple Criteria Find & Replace Alfred Excel Worksheet Functions 3 October 21st 09 07:13 PM
multiple find and replace Andre Excel Worksheet Functions 1 May 26th 09 02:31 PM
Multiple Find and Replace in one function [email protected] Excel Worksheet Functions 4 September 11th 06 03:16 AM
Combining two Subs Petitboeuf Excel Discussion (Misc queries) 6 April 27th 06 03:42 PM
Combining find with clearcontents on multiple columns RussB Excel Programming 1 January 13th 06 11:20 PM


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