VBA使Dropdown始终可见Excel

时间:2018-02-05 15:21:26

标签: excel vba excel-vba

我在互联网上找到了这个代码,它应该从下拉菜单中看到那些小箭头。这有效,但我想只显示以下单元格:

B2,B11,B12,B13

Sub ShowArrowsExceptOne()
'shows all arrows except
' in specified field number
Dim c As Range
Dim rng As Range
Dim i As Long
Dim iHide As Long
Set rng = ActiveSheet.AutoFilter.Range.Rows(1)
i = 1
iHide = 3 'leave this field's arrow hidden
Application.ScreenUpdating = False

For Each c In rng.Cells
  If i = iHide Then
    c.AutoFilter Field:=i, _
      Visibledropdown:=False
  Else
      c.AutoFilter Field:=i, _
      Visibledropdown:=True
  End If
  i = i + 1
Next

Application.ScreenUpdating = True
End Sub

我尝试了以下方式:     昏昏欲睡     昏暗的iHide长     i = 1     iHide = 3'隐藏此字段的箭头     Application.ScreenUpdating = False

With Intro.Range("B2")
    .AutoFilter Field:=2, _
        Visibledropdown:=True
End With


Application.ScreenUpdating = True

但它始终会在 B1,C1和D1

上显示下拉菜单

有人可以帮我吗?

The button I want to be visible

0 个答案:

没有答案