我一直在努力完成這項工作。它在我的x64版本的辦公室中運行良好,但在同事的計算機上運行的不是x86。任何人都可以給我修補嗎?範圍類的自動填充方法失敗 - 我的代碼需要幫助
VBA引擎強調Range("AV5").AutoFill Destination:=Range("AV5:AV" & NoOfClients)
的原因
Private Sub Check_Cases_Click()
Dim NoOfClients As Long
Application.DisplayAlerts = False
CO_Select = Application.InputBox("Please input the name of caseworker you would like to check on.", "Caseworker Name")
Range("A2").value = CO_Select
Application.ScreenUpdating = False
NoOfClients = Range("C2").value
CO_Name = Range("A2").value
CheckCaseMsg = MsgBox(CO_Name & ", there are " & NoOfClients & " clients under your name." & vbNewLine & vbNewLine & _
"System will now calculate all your active cases and display " & vbNewLine & _
"all the clients for your information." & vbNewLine & vbNewLine & _
"Confirm?", vbYesNo, "Case Checking")
If CheckCaseMsg = vbNo Then
Exit Sub
End If
If CheckCaseMsg = vbYes Then
'Remove the filters if one exists
'=========================================
If ActiveSheet.FilterMode Then
Selection.AutoFilter
End If
Clear
Startup_Formula
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Range("AV5").AutoFill Destination:=Range("AV5:AV" & NoOfClients)
Application.Calculation = xlCalculationAutomatic
Range("GI_Table[[#All],[Client number]]").Copy
Range("GI_Table[[#All],[Client number]]").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.ScreenUpdating = True
ActiveSheet.ListObjects("GI_Table").Range.AutoFilter Field:=2, Criteria1:= _
Array("ACTIVE", "INACTIVE", "RENEWED"), Operator:=xlFilterValues
GI_CustomSort
GI_CustomSort
MsgBox "Case Checking Ready", vbInformation, "Ready"
End If
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
它不必是Fill Down動作,我猜它可以是n次拷貝(n = NoOfClients)。我指定爲Startup_Formula的公式是一個子公式,它包含數組公式'Sub Startup_Formula() Sheets(「Grand Info Sheet」)。Range(「AV5」)。FormulaArray =「= IFERROR(INDEX(Table_MIS [CLIENTNUM],小(IF($ A $ 2 = Table_MIS [CASEWORKER],「&_ 」ROW(Table_MIS [CASEWORKER]) - MIN(ROW(Table_MIS [CASEWORKER]))+ 1,「」「」),ROW(AV5)) ),「」「」)「 End Sub' – herman925
基本上我需要使用數組公式,並根據我在表中檢測到的NoOfClients填充它多次... – herman925