Hey All! Happy Friday-Eve!
The below code is working perfectly to add new records to a workbook, but I would like to alter it to have the ability to UPDATE an EXISITING record.
So rather than it looking for the first empty row, I need it to find a match for a record, then paste in the data (same as below) starting in row of the first match it found.
Record to search for: Sch_Pricing tab in cell B1
Where to search for record: Main tab in col A
Data to paste: same data as below
Where to paste: Starting in the first row of the matching data
I hope this provides enough information, but please let me know if you need more! Thanks so much for your help on this! ?
The below code is working perfectly to add new records to a workbook, but I would like to alter it to have the ability to UPDATE an EXISITING record.
So rather than it looking for the first empty row, I need it to find a match for a record, then paste in the data (same as below) starting in row of the first match it found.
Record to search for: Sch_Pricing tab in cell B1
Where to search for record: Main tab in col A
Data to paste: same data as below
Where to paste: Starting in the first row of the matching data
I hope this provides enough information, but please let me know if you need more! Thanks so much for your help on this! ?
VBA Code:
Private Sub Update_Master_Click()
With Sheets("Main")
Dim FirstEmptyRow As Long
FirstEmptyRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
Sheets("Sch_Pricing").Range("B2:M16").Copy
.Cells(FirstEmptyRow, "A").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Sheets("Sch_Pricing").Range("B17:M37").Copy
.Cells(FirstEmptyRow, "FJ").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Excel.Application.CutCopyMode = False
End With
End Sub