Excel error - the macros in this project are disabled, please refer to the online help or documentation of the host application to determine how to enable macros.
alt+F11 进入vba界面,F5运行macro后报错。
Sub 合并当前工作簿下的所有工作表() Application.ScreenUpdating = False For j = 1 To Sheets.Count If Sheets(j).Name <> ActiveSheet.Name Then X = Range("A65536").End(xlUp).Row + 1 Sheets(j).UsedRange.Copy Cells(X, 1) End If Next Range("B1").Select Application.ScreenUpdating = True MsgBox "当前工作簿下的全部工作表已经合并完毕!", vbInformation, "ATTENTION!" End Sub
error: the macros in this project are disabled, please refer to the online help or documentation of the host application to determine how to enable macros.
Solution 1: 检查安全中心的设置。
Enable VBA macros is "checked".
Solution 2:
看看macro书不是创建在了正确的Excel object下,有时候打开太多excel。默认按ALT+F11会在其他excel object下创建macro。
在对应的object下创建新的module,然后输入代码。Function + F5运行。成功!