Dear Forum,
Newbie to VBA here and would appreciate some advice or help on the below query please.
I have searched through the forum and Google and found a few bits and pieces that almost match but I dont have the knowhow to amend the code. What I am trying to achieve is:
- I have a basic userform to enter data, when a command button is clicked the data is transferred into a ws called "Update Quality Check Data" - this works perfeclty so far
- What I am now trying to do is find data in the ws "Update Quality Check Data: transfer it to a table in another sheet.
In the ws:
- Column A:A contains Months
- Column B:B contains Names
- Column C:C contains Ticket Numbers
What I need to do is transfer onlythe Ticket numbers to seperate sheets If month and Name match, the sheet looks something like this:
A B C
June John 123
June William 456
July John 789
July David 101
July Bob 112
So to summarize what I would like to achieve is:
IF A:A = "June", AND B:B = "John"
Copy C:C orders of John in June, July etc. to ws named John starting at cell D5 and going down until there is no more matching entries
I have tried to have a go as per below but failed miserably so far:
Private Sub Data_Transfer()
Dim LastRow As Long
'Ticket is the data on Update Quality Checks Data sheet to be transferred to Sheet "David"
Dim Ticket As Range
LastRow = Cells(Row.Count, "C").End(xlUp).Row
'Activate Quality Checks sheet
Sheets("Update Quality Checks Data").Select
'Select the Range to be copied
Range("C2:C" & LastRow).Select
For Each TicketRow In Range("C7:C" & LastRow)
'If A:A on Update Quality Sheet Data = June and B:B = John, copy C:C to ws John starting from cell D5
If Range("A:A").Value = "June" And Range("B:B").Value = "John" Then
Selection.Cut
Sheets("David").Select
Range("D5" & Columns.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
End If
Next Ticket
End Sub
Display More
Is this possible? and as people enter the data into the useform would this automatically update the table on John's ws?
Sorry for the complex babble, hopefully it makes some sense.
Kind Regards
Bob