Hi
Try the following code, which splits up your macro in to two parts one for the button and one for the code you wish to call.
Private Sub CommandButton1_Click()
Dim Msg, Style, Title, Response
Msg = "Send Scaffold to destruct?"
Style = vbYesNo + vbCritical
Title = "Scaffold Destruct"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Call scaffold
Else
End
End If
End Sub
Sub scaffold()
Worksheets("sheet2").Activate
ActiveSheet.Range("b4").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
Worksheets("sheet1").Range("A4:h4").Copy
Worksheets("sheet2").Paste Destination:=ActiveCell.Offset(0, -1)
Worksheets("sheet1").Activate
Worksheets("Sheet1").Rows(4).Delete
End Sub
Regards
Jeff
Bookmarks