VBA Dialog box FindAll

ziad alsayed

Well-known Member
Joined
Jul 17, 2010
Messages
665
dear all

i am trying use the dialog box "find" to find the Word "TOTAL" in column G, so after finding it i will press Find all and all cells with the Word "Total" will be select, so now i will loop through each cell and delete the entire row completly.

i tried to use the recording but it didn't work. i succeed to launch the find dialog box but don't know what to do after .

below is what i found

Code:
Sub RemoveTotal()
    Columns("G:G").Select
    Application.Dialogs(xlDialogFormulaFind).Show
End Sub

appreciate any help.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
dear GlennUK

thanks for your reply,this works and i tried it before, just wnat to learn doing it by using the dialog box find :)

hope you can assist.
 
Upvote 0
dear GlennUK

thanks for your reply,this works and i tried it before, just wnat to learn doing it by using the dialog box find :)

hope you can assist.
I don't think you'll be able to do it (doing FindAll is probably doable, but not the Select All afterwards. Try:
Code:
Sub RemoveTotal()
Dim cellsToDelete As Range
With Columns("G:G")
    Set c = .Find("Total")
    If Not c Is Nothing Then
        FirstAddress = c.Address
        Set cellsToDelete = c
        Do
            Set c = .FindNext(c)
            Set cellsToDelete = Union(cellsToDelete, c)
        Loop Until c.Address = FirstAddress
    End If
End With
cellsToDelete.EntireRow.Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,813
Members
452,945
Latest member
Bib195

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top