ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to assign a worksheet in VBA (https://www.excelbanter.com/excel-programming/447201-how-assign-worksheet-vba.html)

[email protected]

How to assign a worksheet in VBA
 
Subject: How to assign a worksheet in VBA
I have declared following:
Dim wsDec As Worksheet

Now I am doing this
Set wsDec = ActiveWorkbook.wsDecoupling

Where wsDecoubling is a worksheet in my workbook, but I get an error
Object does not support this property or method, what is the correct way to refer to a sheet in a wokbook in VBA.

Thanks,



Ben McClave

How to assign a worksheet in VBA
 
Try

Set wsDec = ActiveWorkbook.Sheets("wsDecoupling")


[email protected]

How to assign a worksheet in VBA
 
On Saturday, September 22, 2012 10:36:38 AM UTC-4, (unknown) wrote:
Subject: How to assign a worksheet in VBA I have declared following: Dim wsDec As Worksheet Now I am doing this Set wsDec = ActiveWorkbook.wsDecoupling Where wsDecoubling is a worksheet in my workbook, but I get an error Object does not support this property or method, what is the correct way to refer to a sheet in a wokbook in VBA. Thanks,


Ben:
Thanks a lot for answering my naive quetsions. Really appreciate your help.

Ben McClave

How to assign a worksheet in VBA
 
Happy to help.


All times are GMT +1. The time now is 08:52 AM.

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