Code string for button

N

Newbeetle

Hi,

I have a command button called “Compare†and I would like it to do the
following when pressed;

1) Compare the date in cell h2 on sheet1 to today's date, if the date is
older than today’s date, copy data in cells h7:h12 to j7-j12 on sheet2.
2) I would then like the date in cell h2 on sheet1 to change to today’s date.

Thanks for any help with this,

Newbeetle
 
F

FSt1

hi
Private Sub CommandButton1_Click()
If Sheets("sheet1").Range("H2").Value < Date Then
Sheets("sheet1").Range("H7:H12").Copy _
Destination:=Sheets("sheet2").Range("J7:J12")
Sheets("sheet1").Range("H2").Value = Date
Else
MsgBox "no go"
Exit Sub
End If
End Sub

regards
FSt1
 

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

Similar Threads


Top