How to access a specific worksheet in vba?

Asdf0qwerty

New Member
Joined
Jul 28, 2010
Messages
19
WorksheetAccessProb.jpg



As of now, I've already enabled my add-in in the Add-In dialog box and started to test in a new Excel Workbook file if it would work. Sadly, my add-in still halts at the statement above resulting to a "#VALUE!" result into the Cell.

In my uploaded image, you can see that there's 2 VBA projects. The one above is my add-in. Now I tried to add-watch "Application.Workbooks". Yes it did see a workbook, but it was VBAProject (Book1), not the workbook of my add-in. So how will I be able to access the Workbook (particularly the unviewable worksheets) of my add-in? TIA.

Btw, the worksheets enclosed inside the red box are the ones I want to access.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
SImply

Code:
Workbooks("ADD-IN WHT CALCU V1.0.xlam").Worksheets("MONTHLY")

OR

ThisWorkbok.Worksheets("MONTHLY")
 
Upvote 0
just in addition to what has already been said

don't know what your code is like but you might need to 'Activate' the worksheet

in this case

Activate.Sheets("NAME")

depending on what you want to do it can work simply
Sheets("name") or
Sheets(index number)


for example in a new work book excel's default
sheets(1) will return sheet named Sheet1
which equivalent to
sheets("Sheet1")
 
Upvote 0
@All : Thank you for everyones inputs! and GBY all

@xld: Thank you!!! :D This did the trick!! :D

@pirdop: Thanks for the additional info. To be honest I don't know if I still need to use it because xld's already worked for me to access values in worksheets that I needed. So, in what case/s in Excel VBA programming should I use "Activate.Sheets(<name>)" ? TIA :D
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,334
Members
449,077
Latest member
Jocksteriom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top