To use a named range like xHidden with the Rows() method in your VBA code, you need to reference the named range correctly. The Rows() method does not accept named ranges directly as a string. Instead, you can use the Range() method to refer to the named range. Here’s how you can modify your subroutines:
Sub HideHidden()
Sheets("Transaction Log").Select
Range("xHidden").EntireRow.Hidden = True
End Sub
Sub ShowHidden()
Sheets("Transaction Log").Select
Range("xHidden").EntireRow.Hidden = False
Range("A1").Select
End Sub
In this code, Range("xHidden") will correctly reference the named range you created, and then you can set the EntireRow.Hidden property as desired. This should resolve the errors you were encountering when trying to use the named range with Rows().
References: