VBA显示过滤器并选择应用

时间:2018-07-23 07:38:20

标签: excel vba excel-vba

我正在某个VBA上开发票,我在努力解决问题,我想知道是否有可能提示窗口显示A列的所有适用过滤器,然后我选择哪个并继续执行脚本?

Sub invoicing()
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Dim wb, twb As Workbook
Dim rn, Dir, Wbn As String
Dim Rws As Variant: Rws = Array("E31", "E32", "E34", "E35", "E36")
Dim Col As Variant: Col = Array("S", "T", "U", "W", "X")

Set twb = ActiveWorkbook
rn = twb.ActiveSheet.Range("K5").Value
Dir = twb.Path & "\Invoicing\"

If ActiveSheet.Name = "Daily" Then
Application.Workbooks.Open (Dir & "Data for Invoicing " & rn & ".xlsx")

'here i need prompt to choose Filters in column A

End If

For c = 0 To 1
For Each wb In Application.Workbooks
If wb.Name Like "Data for Invoicing" & "*" & ".xlsx" Then
    Wbn = wb.Name
    Workbooks(Wbn).Sheets(rn).Activate
    Workbooks(Wbn).Sheets(rn).Range("R2").Select
    Selection.Copy
    twb.Activate
    twb.ActiveSheet.Range("E30").PasteSpecial xlPasteValues
B = 0
For i = 0 To 4
    Workbooks(Wbn).Sheets(rn).Activate
    Workbooks(Wbn).Sheets(rn).Range(Col(i) & "2").Select
    Selection.Copy
    twb.Activate
    twb.ActiveSheet.Range(Rws(B)).PasteSpecial xlPasteValues
B = B + 1
    Next i
Application.ScreenUpdating = True
Application.DisplayAlerts = True
twb.Activate
    Exit Sub
    End If
Next wb
Application.Workbooks.Open (Dir & "Data for Invoicing " & rn & ".xlsx")
Application.DisplayAlerts = True
Next c
End Sub

0 个答案:

没有答案