Referencing a sheet as an object (not by name)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top