Loop until meet requirement

keevans

Board Regular
Joined
Aug 22, 2013
Messages
77
I want to call a procedure "DeleteSignature" until a condition is met. My condition would be Range("A45").Value="Contact". How do I set up the loop? Is a loop the right thing to use? Sorry VBA newbie here. Your help is appreciated!
 

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
Ideally you would be doing something like a "Do-----Loop until range("A45").value...." but what exactly are you looping through(rows, columns,range...) and what does the deletesignature do?
 
Upvote 0
Thanks! That's kind of what I was thinking, I just don't know how to write it. :S My delete signature is copied below.

Code:
Sub DeleteSignatures()
Range(Rows(46), Rows(46 + 5)).Select
Selection.Delete Shift:=xlUp
End Sub
 
Upvote 0
Looking at the situation, do you really need a Loop? I think not

What of having it this way?
Code:
Sub DeleteSignatures()
    If Range("A45").Value <> "Contact" Then
        Range(Rows(46), Rows(46 + 5)).Select
        Selection.Delete Shift:=xlUp
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,552
Messages
6,114,278
Members
448,560
Latest member
Torchwood72

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