Getting the error: “Invoke VBA: Cannot run the macro ‘CheckHiddenRowsColumns’. The macro may not be available in this workbook or all macros may be disabled.”
The code that I am implementing:
Function CheckHiddenRowsColumns(sheetName As String) As Boolean
Dim cell As Object
Dim hiddenRows As Boolean
Dim hiddenColumns As Boolean
' Activate the specified sheet
Sheets(sheetName).Activate
' Check for hidden rows
For Each cell In ActiveSheet.UsedRange.Rows
If cell.EntireRow.Hidden Then
hiddenRows = True
Exit For
End If
Next cell
' Check for hidden columns
For Each cell In ActiveSheet.UsedRange.Columns
If cell.EntireColumn.Hidden Then
hiddenColumns = True
Exit For
End If
Next cell
' Set the result based on hidden rows or columns
CheckHiddenRowsColumns = hiddenRows Or hiddenColumns
End Function
Any idea on why this is happening? Thanks in advance


