ColinCoady
New Member
- Joined
- Mar 21, 2019
- Messages
- 35
The following code works great in posting data from one workbook to another but it posts to the last open row. Which was fine at the time but now I want it to do something different. The 1st column in the closed workbook (QuoteListing.xlsx) has unique data in it already and I want to find the row that matches the criteria from the workbook I'm working in(Tenant Billing.xlsm) and post data into the 2nd to 5th columns.
Can I get some help with making it work. The criteria is in cell B4 and that value will match on 1 cell only in the data in Column A in the closed workbook.
Here is my current code
Can I get some help with making it work. The criteria is in cell B4 and that value will match on 1 cell only in the data in Column A in the closed workbook.
Here is my current code
Code:
Private Sub CommandButton1_Click()
Dim itemDate As String
Dim itemShortDsc As String
Dim myData As Workbook
Worksheets("InfoEntry").Select
itemDate = Range("B3")
itemShortDsc = Range("B13")
itemProperty = Range("B6")
itemTenant = Range("B7")
Set myData = Workbooks.Open("C:\USERS\ccoady\Desktop\Tenant Billing\QuoteListing.xlsx")
Worksheets("QList").Select
Worksheets("QList").Range("B1").Select
RowCount = Worksheets("Qlist").Cells(Rows.Count, 2).End(xlUp).Row
With Worksheets("QList").Range("B1")
.Offset(RowCount, 0) = itemProperty
.Offset(RowCount, 1) = itemTenant
.Offset(RowCount, 2) = itemShortDsc
.Offset(RowCount, 3) = itemDate
End With
myData.Save
myData.Close
End Sub