excel - Passing Worksheet To Sub Routine -


i trying call sub routine passing sheetname parameter, receive following error:

object doesn't support property or method 

here code:

public sub performanceleague()  dim wsperformanceleague worksheet  set wsperformanceleague = worksheets("performanceleague") setheadings wsperformanceleague  end sub  public sub setheadings(ssheet worksheet)  dim headers() variant dim ws worksheet dim wb workbook  application.screenupdating = false  end sub 

i have tried calling sub routine below well, receive same error:

call setheadings(wsperformanceleague) 

  1. declare wsperformanceleague worksheet. dim wsperformanceleague worksheet

  2. change wsperformanceleague = worksheets("performanceleague") set wsperformanceleague = worksheets("performanceleague")

you have use word set


Comments