Referencing a sheet as an object (not by name)

  • Thread starter Thread starter DTM
  • Start date Start date
D

DTM

The problem I am having is I am trying to pass my sheets as object
instead by name (strings). I get:

=============================
Run-time error '438':

Object doesn't support this property or method
=============================

when I call this procedure:

Public Sub ProtectSheets(wks_Worksheet As Worksheet)
wks_Worksheet.Protect password:="password"
End Sub

from code like:

Dim wks_source as Worksheet
Set wks_source = ActiveWorkbook.Worksheets("sheet1")
ProtectSheets(wks_source) '*** FAILS HERE ***

What am I missing
 
Back
Top