
Originally Posted by
Mandeep Baluja
put this code in command button click event
Private Sub CommandButton1_Click()
Dim Row As Integer
If Range("C15").Value = "" Or Range("C17").Value = "" Then
MsgBox ("Select Structure code and Input Quantity of Materials")
Else
Row = 2
Set ws = ActiveSheet
lr = Application.WorksheetFunction.Count(Range("E15:E50")) + 14
Worksheets("Steel Pole").Range("E14:G" & lr).Copy
lr = Worksheets("data").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Data").Cells(lr + 1, 1).PasteSpecial Paste:=xlPasteValues
MsgBox ("The data has been recorded!")
Range("C15", "C17").Value = ""
Application.CutCopyMode = False
End If
End Sub
Bookmarks