|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
模块一 可以正常生成两个切片器
模块二,变量后增加个数字,出错,显示 无效的过程调用或参数
因为表格比较多,需要调整切片器名称
模块一代码
Dim k As String
k = "名称"
Application.CutCopyMode = False
ActiveWorkbook.SlicerCaches.Add2(ActiveSheet.ListObjects("现浇板"), "名称"). _
Slicers.Add ActiveSheet, , k, k, 188.25, 639.75, 144, 187.5
ActiveWorkbook.SlicerCaches("切片器_" & k).Slicers(k).NumberOfColumns _
= 3
k = "混凝土强度等级"
Application.CutCopyMode = False
ActiveWorkbook.SlicerCaches.Add2(ActiveSheet.ListObjects("现浇板"), "混凝土强度等级"). _
Slicers.Add ActiveSheet, , k, k, 188.25, 639.75, 144, 187.5
ActiveWorkbook.SlicerCaches("切片器_" & k).Slicers(k).NumberOfColumns _
= 3
End Sub
模块二 代码
Sub 宏2()
'
' 宏1 宏
'
Dim k As String
k = "名称1"
Application.CutCopyMode = False
ActiveWorkbook.SlicerCaches.Add2(ActiveSheet.ListObjects("现浇板"), "名称"). _
Slicers.Add ActiveSheet, , k, k, 188.25, 639.75, 144, 187.5
ActiveWorkbook.SlicerCaches("切片器_" & k).Slicers(k).NumberOfColumns _
= 3
k = "混凝土强度等级"
Application.CutCopyMode = False
ActiveWorkbook.SlicerCaches.Add2(ActiveSheet.ListObjects("现浇板"), "混凝土强度等级"). _
Slicers.Add ActiveSheet, , k, k, 188.25, 639.75, 144, 187.5
ActiveWorkbook.SlicerCaches("切片器_" & k).Slicers(k).NumberOfColumns _
= 3
End Sub
|
|