ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vb.net calling worksheet by name (https://www.excelbanter.com/excel-programming/360024-vbulletin-net-calling-worksheet-name.html)

Barnie[_2_]

vb.net calling worksheet by name
 
Hi all,
Does any one know how to call a spread sheet by name?

I tried

Myworksheet = workbook.worksheets("Sheet3")

But that doesn't work. Everything else on my code is working fine except
that. Am I missing anything?

Thank you!


Barnabas (Barnie) Yohannes
http://www.geocities.com/barnabas_yohannes
"So powerful is the light of unity that it can illuminate the whole earth"



NickHK

vb.net calling worksheet by name
 
Barnie,
Don't know about .Net, but VB/VBA would require a Workbook object, not just
the word "workbook", or use 'ThisWorkbook". And the use of "Set", because
the variables are objects.
Dim WB as Workbook
Dim MyWorkSheet as Worksheet

Set WB=Workbooks.Add
Set Myworksheet =WB.Worksheets("Sheet3")

NickHk

"Barnie" wrote in message
...
Hi all,
Does any one know how to call a spread sheet by name?

I tried

Myworksheet = workbook.worksheets("Sheet3")

But that doesn't work. Everything else on my code is working fine except
that. Am I missing anything?

Thank you!


Barnabas (Barnie) Yohannes
http://www.geocities.com/barnabas_yohannes
"So powerful is the light of unity that it can illuminate the whole earth"






All times are GMT +1. The time now is 11:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com