https://drive.google.com/file/d/0B9D...ew?usp=sharing
^ this is the link to the spreadsheet so you can visually see what is going on.
What I need:
A code that searches (RPA!D5 to last row) against the numbers in (Feature Report!Q to last row), giving me the value if contains one of these values. (First Instance only) 65, 64.99, 40, 45, 30, 35, 15, 20, 10, 50 then put that number in (RPV!)
A code that searches (RPA!D5 to last row) against the numbers in (Feature Report!Q to last row), giving me the value if (Feature Report!AI2 to last row) contains a wildcard such as (*EPTT*) so if it is EPTT05 give me the value next to it (Feature Report!AM) put that number in (RPAA!) I need this to add all the values up. Since one phone number can have multiple instances of the feature MRC.
A code that copies all the phone numbers from (Smart Report:Q2 to Last Row) and paste them in (RPA:D5 to Last row).
Below is a code that I Have at the moment. The issue with it, is that it doesn't do Wildcards, and has the static range of 5-3004 rather than 5-last used row. The last used row is still being judged by column D. Once I have the code done once, I will use it as a template to complete the project.
Option Explicit
Sub FeatureReportValues()
Dim last_srcRw As Long, srcRw As Long
Dim firstAddress As String
Dim phNum As Range
'Set Feature_Report!Q:Q as search range
With Sheets("Feature Report").Range("Q:Q")
'Loop through RPA!D5:D3004
For srcRw = 5 To 3004
'Make sure the cell is not empty
If Sheets("RPA").Range("E" & srcRw) <> "" Then
'Find Phone Number in Feature Report!Q:Q
Set phNum = .Find(Sheets("RPA").Range("D" & srcRw))
'If match is found, check value in Column AM against list
If Not phNum Is Nothing Then
firstAddress = phNum.Address
Do
Select Case Sheets("Feature Report").Range("AM" & phNum.Row)
Case 65, 64.99, 40, 45, 30, 35, 15, 20, 10, 50
'If value from list is found, copy value to RPA!V
Sheets("RPA").Range("V" & srcRw) = _
Sheets("Feature Report").Range("AM" & phNum.Row)
Exit Do
End Select
'If value from list not found, seach for next ccurrence of same Phone Number
Set phNum = .FindNext(phNum)
Loop While Not phNum Is Nothing And phNum.Address <> firstAddress
End If
End If
Next
End With
Dim last_srcRw As Long, srcRw As Long
Dim firstAddress As String
Dim phNum As Range
'Set Feature_Report!Q:Q as search range
With Sheets("Feature Report").Range("Q:Q")
'Loop through RPA!D5:D3004
For srcRw = 5 To 3004
'Make sure the cell is not empty
If Sheets("RPA").Range("D" & srcRw) <> "" Then
'Find Phone Number in Feature Report!Q:Q
Set phNum = .Find(Sheets("RPA").Range("E" & srcRw))
'If match is found, check value in Column AI against list
If Not phNum Is Nothing Then
firstAddress = phNum.Address
Do
Select Case Sheets("Feature Report").Range("AI" & phNum.Row)
Case EPUG
'If value from list is found, copy value to RPA!AO
Sheets("RPA").Range("AO" & srcRw) = _
Sheets("Feature Report").Range("AM" & phNum.Row)
Exit Do
End Select
'If value from list not found, seach for next ccurrence of same Phone Number
Set phNum = .FindNext(phNum)
Loop While Not phNum Is Nothing And phNum.Address <> firstAddress
End If
End If
Next
End With
End Sub
Bookmarks