Ok. So I might be going about this the wrong way, but here's what I have working so far.
a) I have found and tweaked a macro to search a particular column for particular medical diagnosis codes and then highlight the whole row if the value is in the array. This works great and does what I want it to do.
b) I have set up a macro that will import a SharePoint list to a new tab. This list will contain all of the medical codes that I need the macro to search for. I am going this route so our users will be able to update the search file easily and will be called up by all the people using the search macro.
Where I am failing is to fit the pieces together is to get the search macro to call the data in the other sheet. In this case I am importing the data to a sheet called "Search_Array" and the diagnosis codes are in column "B" but the data I want to search is in the active sheet titled "All Claims by Date of Service". Below is the functioning code, but I can't figure out how to get the search array to be in the other worksheet.
Thanks in advance,
-Ryan
[pre]
[/pre]
a) I have found and tweaked a macro to search a particular column for particular medical diagnosis codes and then highlight the whole row if the value is in the array. This works great and does what I want it to do.
b) I have set up a macro that will import a SharePoint list to a new tab. This list will contain all of the medical codes that I need the macro to search for. I am going this route so our users will be able to update the search file easily and will be called up by all the people using the search macro.
Where I am failing is to fit the pieces together is to get the search macro to call the data in the other sheet. In this case I am importing the data to a sheet called "Search_Array" and the diagnosis codes are in column "B" but the data I want to search is in the active sheet titled "All Claims by Date of Service". Below is the functioning code, but I can't figure out how to get the search array to be in the other worksheet.
Thanks in advance,
-Ryan
[pre]
Code:
Sub PRIMARY_DX_1_search()
Dim FirstAddress As String
Dim MySearch As Variant
Dim myColor As Variant
Dim Rng As range
Dim I As Long
MySearch = Array("4293","42500","42800","V570","42600","41400") <--- this where I'd like to put the array reference to the other worksheet.
With Sheets("All Claims by Date of Service").range("G5:G55000")
For I = LBound(MySearch) To UBound(MySearch)
Set Rng = .Find(What:=MySearch(I), _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
FirstAddress = Rng.Address
Do
With ActiveSheet.range("B" & Rng.Row & ":O" & Rng.Row)
.Font.ColorIndex = 1
.Interior.ColorIndex = 4
End With
Set Rng = .FindNext(Rng)
Loop While Not Rng Is Nothing And Rng.Address <> FirstAddress
End If
Next I
End With
End Sub