How to get worksheet as output variable

Team…I have one issue…i want to get worksheet as output variable
eg : Wks as worksheet

I want to pass this worksheet variable into VBA code.

Thanks for your support

are you expecting worksheet name stored in a variable as string?

Hi @saransrs

Use excel application scope and create a workbook variable

use assign StrWorkBookSheets=wb.GetSheets

Ashwin S


For example I want to pass worksheet as argument into the function in invoke vba.

Public Function FindLastColumn(ByVal workingsheet As Worksheet)

FindLastColumn = workingsheet.Cells(1, Columns.Count).End(xlToLeft).Column
Exit Function
End Function


@saransrs This will give you array of string containing sheet name(s). You can pass this array output as input to the VBA