0

How to use table from hidden sheet ?

I get error on

With Range("AI5:AI" & LastRow).Validation
    .Delete
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
    xlBetween, Formula1:="=MyTableFromHiddenSheet"
    .IgnoreBlank = True: .InCellDropdown = True: .InputTitle = vbNullString: .ErrorTitle = vbNullString: .InputMessage = vbNullString:          .ErrorMessage = vbNullString: .ShowInput = False: .ShowError = True
End With

It required to create namedrange with refernce to Table1 no direct access like in unhided sheet?

1 Answers1

0

Are you sure you are receiving the error due to the sheet being hidden? The code appears to work properly for me even with a hidden sheet once I remove the undefined variable (in the snippet) LastRow.

To name the range (if that's the issue you're having), you can use the following (even on a hidden sheet):

Sheets("Sheet1").Range("A1:B2").Name = "NameForRange"
PerpetualStudent
  • 822
  • 9
  • 17