所以我找到并修改了一个适合我需要的宏,但是有一个限制。我正在构建一个宏来搜索特定诊断代码和程序代码的医疗支付数据。在我目前正在处理的项目中,只有 14 个诊断代码,因此我能够将其直接放入 VBA。但是,有超过 800 个程序代码无法放入 VBA。我能够执行一个单独的 VBA 步骤来引入包含这些数据的表,但我似乎无法将其设置为针对该表进行搜索。但话虽如此,运行此 VBA 搜索如此大量项目的最佳方法是什么?
Sub PROCEDURE_1_search()
Dim FirstAddress As String
Dim MySearch As Variant
Dim myColor As Variant
Dim Rng As range
Dim I As Long
MySearch = Array("412", "4100", "4101", "4102", "4103",...) <-- have over 800
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
我可能会想出一个答案,而不是问正确的问题。如果有什么我可以澄清的,请告诉我,并提前感谢您的帮助。
-瑞安