I have a workbook I enter data and have to wait for product approval before sending to a different workbook that everyone else looks at that has all the approved products. Right now I have 2 different buttons to use to send the entire row of selected cell to other workbook based on the product type in column# 10 in the selected row.
Can I consolidate these 2 buttons so that the macro pastes the row into the correct sheet based on the cell value in column # 10 in the selected row? Here is the code I have for the first sheet.
Can I consolidate these 2 buttons so that the macro pastes the row into the correct sheet based on the cell value in column # 10 in the selected row? Here is the code I have for the first sheet.
VBA Code:
Sub Button3_Click()
'enters date approved
Cells(Application.ActiveCell.Row, 9) = Now()
'enters days waited for approval
Cells(Application.ActiveCell.Row, 13) = Cells(Application.ActiveCell.Row, 9) - Cells(Application.ActiveCell.Row, 8)
Cells(Application.ActiveCell.Row, 13).NumberFormat = "0"
'copy entire row of selected cell and paste to wb sheet 1
Selection.EntireRow.Select
Selection.CopyDim wb As Workbook
Set wb = Workbooks.Open("filename.xlsx")
wb.Worksheets("Sheet1").Select
On Error Resume Next
Dim xCell As Range
For Each xCell In ActiveSheet.Columns(1).Cells
If Len(xCell) = 0 Then
xCell.Select
Exit For
End If
Next
Selection.PasteSpecial (xlPasteValues)
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=" filename.xlsx"
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub
Last edited by a moderator: