请问运行自己添加的VBA代码的时候会弹出这么一步,怎么样才能让这一步不弹出直接运行代码?
大佬还是不行啊,而且跑了自己的代码之后,你里面的代码功能也会失效,只能重装才能重新生效,我把代码贴在下面您帮忙看一下是为啥。
Sub GetAllSheetNames()
Dim ws As Worksheet
Dim outputCell As Range
Dim rowNum As Integer
On Error Resume Next
Set outputCell = Application.InputBox("Select a cell to output sheet names:", Type:=8)
On Error GoTo 0
If outputCell Is Nothing Then
MsgBox "Operation cancelled."
Exit Sub
End If
rowNum = outputCell.Row
For Each ws In ActiveWindow.SelectedSheets
outputCell.Cells(rowNum, 1).Value = ws.Name
rowNum = rowNum + 1
Next ws
If rowNum = outputCell.Row Then
MsgBox "No sheets selected."
End Sub
我的没有问题啊 你要不更新一下?你的这个代码好像也不太听使唤
或者你调试运行 ,把报错的文件上传 发我下
我重新在excel安装文件里面打开了一下excel,后面就可以了,很奇怪,不知道是不是因为加了一些.xlam在自启动文件夹里面,不过反正可以用了,多谢大佬
大佬还是不行啊,而且跑了自己的代码之后,你里面的代码功能也会失效,只能重装才能重新生效,我把代码贴在下面您帮忙看一下是为啥。
Sub GetAllSheetNames()
Dim ws As Worksheet
Dim outputCell As Range
Dim rowNum As Integer
On Error Resume Next
Set outputCell = Application.InputBox("Select a cell to output sheet names:", Type:=8)
On Error GoTo 0
If outputCell Is Nothing Then
MsgBox "Operation cancelled."
Exit Sub
End If
rowNum = outputCell.Row
For Each ws In ActiveWindow.SelectedSheets
outputCell.Cells(rowNum, 1).Value = ws.Name
rowNum = rowNum + 1
Next ws
If rowNum = outputCell.Row Then
MsgBox "No sheets selected."
End If
End Sub
我的没有问题啊 你要不更新一下?
你的这个代码好像也不太听使唤