如何用vba语言 删除指定工作表
发布网友
发布时间:2022-04-23 23:05
我来回答
共3个回答
热心网友
时间:2023-10-13 02:02
Sub stopDeleSheet()
Application.CommandBars(1).Controls(2).Controls(12).Enabled = False
End Sub
运行后效果如图,如果放在工作簿打开事件中,就能对该工作簿自动生效。你也可以把这句代码放在模块中作为Excel加载项,这样就可以对所有Excel文档生效了
热心网友
时间:2023-10-13 02:03
你打开新的工作表后,再用程序关掉原来的就是了.
热心网友
时间:2023-10-13 02:03
注意下面*括起来的代码
Private Sub TextBox1_Change()
Dim i As Integer
For i = 1 To 100
If TextBox1.Text = Worksheets("数据").Cells(1, i) Then
Worksheets("数据").Select
Worksheets("数据").Cells(4, i - 1).Select
'***************
if Charts.count < 1 then
Charts.Add
end if
'***************
ActiveChart.ChartType = xlLine
ActiveChart.SeriesCollection(1).Name = Worksheets("数据").Cells(3, i)
ActiveChart.SeriesCollection(1).Values = Range(Worksheets("数据").Cells(4, i), Worksheets("数据").Cells(5000, i))
ActiveChart.SeriesCollection(1).XValues = Range(Worksheets("数据").Cells(4, i - 1), Worksheets("数据").Cells(5000, i - 1))
ActiveChart.Activate
ActiveChart.Axes(xlCategory).Select
ActiveChart.Activate
ActiveChart.Axes(xlCategory).Select
Selection.MajorTickMark = xlInside
ActiveChart.Activate
ActiveChart.Axes(xlValue).Select
ActiveChart.Activate
Selection.MajorTickMark = xlInside
ActiveChart.Activate
ActiveChart.Axes(xlCategory).Select
ActiveChart.Activate
End If
Next
End Sub