Hi all,
I've done a lot of research on vba and using other peoples codes to adapt my own for my own uses. but tit seems the more niche the result you want, the less information you can find to help you.
i have created a salesman's sheet that copy's data from a raw data input, into separate sheets organised by site.
Within these sites there are a 3 sales people with their own specific ranges.
for instance below, starting on row 64 the formula will copy anything from E2:200 on the raw data input sheet containing the name Alex Philips, and will paste them in to the target sheet which is Solent new data.
each sales man will sell a selection of new and used bikes, these bikes have stock numbers start with 2 letters followed by 4 numbers. so for example NT3000 or UT3000 these stand for NT - New Triumph or UT - Used Triumph.
what id like to do is utilise the formula below to contain an IF AND statement which looks for the name of the sale person in Column E and then also in Column A Searches for the stock number (anything containing either NT). if the criteria is met then it will copy the record over as it did before, but only the new stock numbers
when i have tried to use wildcards before I'm certain i was doing it wrong.
any help would be greatly appreciated.
I've done a lot of research on vba and using other peoples codes to adapt my own for my own uses. but tit seems the more niche the result you want, the less information you can find to help you.
i have created a salesman's sheet that copy's data from a raw data input, into separate sheets organised by site.
Within these sites there are a 3 sales people with their own specific ranges.
for instance below, starting on row 64 the formula will copy anything from E2:200 on the raw data input sheet containing the name Alex Philips, and will paste them in to the target sheet which is Solent new data.
each sales man will sell a selection of new and used bikes, these bikes have stock numbers start with 2 letters followed by 4 numbers. so for example NT3000 or UT3000 these stand for NT - New Triumph or UT - Used Triumph.
what id like to do is utilise the formula below to contain an IF AND statement which looks for the name of the sale person in Column E and then also in Column A Searches for the stock number (anything containing either NT). if the criteria is met then it will copy the record over as it did before, but only the new stock numbers
when i have tried to use wildcards before I'm certain i was doing it wrong.
any help would be greatly appreciated.
VBA Code:
'DTS
Sub CopyAlexPhillips()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
' Change worksheet designations as needed
Set Source = ActiveWorkbook.Worksheets("Raw Data")
Set Target = ActiveWorkbook.Worksheets("Solent New Data")
j = 64 ' Start copying to row 64 in target sheet
For Each c In Source.Range("E2:E200") ' Do 200 rows
If c = "Alex Philips" Then
Source.Rows(c.Row).Copy Target.Rows(j)
j = j + 1
End If
Next c
End Sub
Last edited by a moderator: