View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Reference cells in a Hidden Worksheet for display in a UserForm

hi
which line is generating the error?

Regards
FSt1

"scott56hannah" wrote:

I have workbook which has a number of reference worksheets that need to be
hidden from the users view.

Those sheets need to be referred to by a UserForm as part of drop down lists
and other validations.

When trying to populate the combo box I get the following error....

Run-time error '1004':
Select method of Range class failed

Refer to the routine that is trying to create the list below

Public Sub SetAllLists()
'This routine will set all lists with the current values that are in place
at that time

'Create the Building Drop Down list for the Inspection form
Worksheets("Reference").Activate
Worksheets("Reference").Range("ReferenceBuildingHe adingStart").Select
If ActiveCell.Offset(1, 0).Value = "" Then
ActiveCell.Offset(1, 0).Select

'If there is only one entry in the List box then no need to sort or do
multiple selection
ElseIf ActiveCell.Offset(2, 0).Value = "" Then
ActiveCell.Offset(1, 0).Select

'If more than one entry then use the sort to refresh the list
Else
ActiveCell.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Sort Key1:=Range("ReferenceBuildingHeadingStart"), _
Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End If

'Now reset the List of details shown on the page
Inspection.frmBuildingComboBox.RowSource =
ActiveWindow.RangeSelection.Address

End Sub

Is there any way to refer to data to worksheets that are hidden without
getting this error ?