求高手帮忙写一个按条件影藏指定列的宏命令
大概意思是:当B1单元格选择“所有”时,不影藏任何列;当B1选择“分析方法验证”时,则自动影藏I、M、P~V列;当B1选择“仪器校验”时,自动影藏M、P、Q列...
大概意思是:当B1单元格选择“所有”时,不影藏任何列;当B1选择“分析方法验证”时,则自动影藏I、M、P~V列;当B1选择“仪器校验”时,自动影藏M、P、Q列
展开
1个回答
2017-02-05 · 知道合伙人软件行家
关注
展开全部
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i%, arr, n%
On Error Resume Next
Application.EnableEvents = False
If Target.Column = 1 Then
arr = Split(Target.Value, ",")
For i = 0 To UBound(arr)
If Application.CountIf(Range("C:C"), arr(i)) = 0 And Application.CountIf(Range("B:B"), arr(i)) = 0 Then
n = IIf(Range("B1") = "", 1, Range("B65536").End(3).Row + 1)
Cells(n, 2) = arr(i)
End If
Next
End If
Application.EnableEvents = True
End Sub
Dim i%, arr, n%
On Error Resume Next
Application.EnableEvents = False
If Target.Column = 1 Then
arr = Split(Target.Value, ",")
For i = 0 To UBound(arr)
If Application.CountIf(Range("C:C"), arr(i)) = 0 And Application.CountIf(Range("B:B"), arr(i)) = 0 Then
n = IIf(Range("B1") = "", 1, Range("B65536").End(3).Row + 1)
Cells(n, 2) = arr(i)
End If
Next
End If
Application.EnableEvents = True
End Sub
追问
高手,能否解释下啊?看不懂呢?怎么没有看见我所说的条件?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询