Help with If/then macro in VBA

D

dstock

I've tried for about 2 days now to get this code right and can't see
to. What I'm trying to do is after the value of a cell reaches <1, i
will cut and paste the entire row after it. Therefore its values wil
be erased in the process. The example will illustrate this, the shee
will essentially just roll foward rows after the specified days = 0.

My thoughs were if sheet1:A1<1, then copy row A2, erase A1

The file attached provides a clear example. I know attachments aren'
preferred but the formatting gets messed up when I try and copy an
paste from excel.

Any help is appreciated

+-------------------------------------------------------------------
|Filename: excelforum example4.zip
|Download: http://www.excelforum.com/attachment.php?postid=3519
+-------------------------------------------------------------------
 
M

mangesh_yadav

Insert a commanbutton from the Control ToolBox menu. And attach the
following code:

Private Sub CommandButton1_Click()

Range("B11") = Range("B11") - 2
If Range("B11") < 1 Then
Range("B11").EntireRow.Delete
Range("B11") = Range("B11") - 2
End If

End Sub


Mangesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top