Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Msg Box to change Macro criteria?

I found the following code on this website and have been using it for a
while. The code deletes rows that I have identified as duplicate rows. Now,
my spreadsheet is getting rather large and I was wondering if there is a way
to start a msg box or something that would allow me to enter what rows in my
column I want to run the macro on... rather than run the code over the
thousands of rows I want to keep already. The code is below.

Thanks for the help.


Sheets("USA Firms").Select

Dim rngToSearch As Range
Dim wks As Worksheet
Dim rngFound As Range

Set wks = ActiveSheet
Set rngToSearch = wks.Columns(3)

Set rngFound = rngToSearch.Find("-")
If rngFound Is Nothing Then
MsgBox "No Deletions Found"
Else
Do
rngFound.EntireRow.Delete

Set rngFound = rngToSearch.FindNext
Loop Until rngFound Is Nothing
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Msg Box to change Macro criteria?

I have fixed my problem Thanks!

"John" wrote:

I found the following code on this website and have been using it for a
while. The code deletes rows that I have identified as duplicate rows. Now,
my spreadsheet is getting rather large and I was wondering if there is a way
to start a msg box or something that would allow me to enter what rows in my
column I want to run the macro on... rather than run the code over the
thousands of rows I want to keep already. The code is below.

Thanks for the help.


Sheets("USA Firms").Select

Dim rngToSearch As Range
Dim wks As Worksheet
Dim rngFound As Range

Set wks = ActiveSheet
Set rngToSearch = wks.Columns(3)

Set rngFound = rngToSearch.Find("-")
If rngFound Is Nothing Then
MsgBox "No Deletions Found"
Else
Do
rngFound.EntireRow.Delete

Set rngFound = rngToSearch.FindNext
Loop Until rngFound Is Nothing
End If
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
Change criteria in a CF CC Excel Discussion (Misc queries) 5 September 14th 09 04:18 PM
Change Row Colour if certain criteria is met Steven Excel Worksheet Functions 2 May 6th 09 01:43 PM
change/set pivot table autofilter criteria with macro button jackie Excel Discussion (Misc queries) 3 March 16th 09 02:03 AM
Can I change background colors based on criteria from another cel. WavMaster Excel Discussion (Misc queries) 2 February 8th 09 07:19 PM
Change Criteria in Code hotherps[_40_] Excel Programming 5 April 11th 04 12:19 PM


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