开发者

pass sheet to a function (excel vba)

开发者 https://www.devze.com 2022-12-17 19:14 出处:网络
I\'ve been trying to pass a sheet in my workbook to a function, but it doesn\'t seem to be working. The function is

I've been trying to pass a sheet in my workbook to a function, but it doesn't seem to be working. The function is

Private Sub passToSheet(theData As Variant, Optional mySheet As Worksheet)

I have tried doing

Dim mySheet as Worksheet
Set mySheet = "Results"

then to call the function

passToSheet theData mySheet

but it doesn't seem to work. I'm not really sure what to google to get the right way to reference the worksheet though! Any help is much a开发者_如何学Goppreciated!


Use

'Set mySheet to worksheet
Set mySheet = Worksheets("Results")

to get a reference to the Worksheet.

0

精彩评论

暂无评论...
验证码 换一张
取 消