Excel won't show the workbooks worksheets - vba

I have an Excel Workbook containing three worksheets. However all sheets seem to be hidden dispite that their visibility is set to xlSheetVisible (Found by looking at the worksheet properties in the VBA editor).
This is what I have tried so far to solve the problem.
Searched Google for help, but all similar problems have been solved by changing the Visibility from xlSheetHidden to xlSheetVisible. But in my case that setting is already set to xlVisible.
By using VBA I have tried to activate a sheet without any result.
By reading this you might have guessed that I am able to see and access the worksheets from the VBA editor.
Despite that looking at the normal Excel userinterface, all buttons are disabled and clicking at the office/file button in the topleft corner doesn't allow me to save the workbook. However if I make any changes to the VBA itself and tries to close the workbook then Excel asks whether or not I would like to save the workbook.

Everything you describe leads me to believe you're hiding the workbook window, not the worksheets. When a workbook window is hidden, all the sheets become hidden and much of the functionality from the toolbar greys out.
In the Visual Basic Editor, you'd also be able to see all of the worksheets and their visibility would be xlVisible, yet they cannot be seen on the screen. This is because they ARE visible, but the window which displays them is not.
Please try clicking the View tab in the toolbar, and then under the Window pane, click Unhide.
If this doesn't work, then try toggling visibility of the workbook.

It sounds like this may really be your problem...
http://vbadud.blogspot.co.uk/2010/08/hide-sheet-tabs-using-vba-hide-excel.html

Related

Prevent excel from closing when closing userform

I hope you can help me with this issue, I couldn't find any answer nor on google nor here. So here's the point:
I have to userforms. One of them opens on Worksheet_Open. In the Background I can still see the worksheet and the excel application. But when I click outside of the userform or close it, the application window disapears too. But in the open processes I can still see excel open.
My intention is to have the Excel window always open (in the background) so that when I close the UserForm the Excel Tables will be visible.
What do I have to code for that? To hide the userform didn't work for me...
Thanks in advance.
Hi there if you want to use both excel and your Userform at the same time then go to your Userform property and make ShowModal = False

Selecting and switching to veryhidden Sheet not working properly

I have been writing a few macros lately to navigate around sheets / change visibility / import-export data etc. I normally just embed the macros as buttons on the sheets.
Normally this works well, however, I do keep experiencing an issue where with a macro, or a userform I unhide a veryhidden sheet, select it and exit the macro, or form.
I do this though via:
With Sheets("Sheet1")
.visibile = xlsheetvisible
.activate
.Range("A1").select
End With
When I then try to manipulate the sheet - e.g. type in a cell, delete data from cell, or insert / delete rows using the GUI rather than doing it via code, the operations happen on the original sheet with the button that called the form or macro. rather than the new one....
Is anyone else experiencing this? Am I doing something wrong?
Give worksheet object for cells while referring the editing
for ex... sheets().range().paste
or activate the sheet which you want to manipulate before your code (which manipulates the sheet)
Found the Solution!!!
Upon further investigation it seems like this is only broken in Office 2013. I tried it on Office 2010 and it worked fine.
The solution is to invoke the vbModeless command after Userform.show so that would be:
Userform1.Show vbModeless
Not perfect, if you want the user to dismiss the Userform before going back to the worksheet, but hey -it's a workaround :)
Let's hope Office 2016 will fix the bug (I'll be upgrading later this month)

Excel protect and unprotect workbook VBA

I have a workbook that contains several (lookup) tabs that I don't want any users to be able to unhide. However, there is one tab that contains admin info that I would like admin users to be able to see. I have a button and macro that prompts for an admin password before unhiding this tab, but if I protect the workbook structure (so that hidden tabs are not accessible for other users) the vba fails. Is there no way to protect/unprotect the workbook from within the admin macro? I have tried various combinations of ActiveWorkbook.Unprotect, ActiveWorkbook.Protect and ActiveWorkbook.ProtectStructure to no avail - both within the admin macro and WorkbookOpen. The error msg I most commonly encounter is "Can't assign to read-only property" even after having ActiveWorkbook.Unprotect at the top of my code. Does anyone know how to work around this? I don't really want to have to leave all tabs open to being unhidden with a second password on the Admin worksheet itself - clumsy!
Instead of protecting the whole workbook, set the Visible property of the sheets you want to hide to xlSheetVeryHidden - you can do this manually in the properties window of the VBA editor. Now those sheets won't show up in the Unhide… dialog. Your macro could swap the visibility of your admin-only sheet from xlSheetVeryHidden to xlSheetVisible and back.
By itself this doesn't protect your workbook from a user who knows how to access the VBA editor and properties, but if you need to do that there seem to be a lot of answers to a quick web search - it may depend on your version of Excel.

Decide which ribbon tab to be selected

The program, that I'm working on, has a separate (additional) Add-in tab in the Excel ribbon. And there are our custom controls, etc. Some of the controls open a new workbook (new Excel window).
In Excel 2010, when the new workbook is opened, our custom tab is selected by default. But in 2013, the first (Home) tab is selected.
In the project, there is no code that controls which tab to be selected by default in a newly open workbook. That is why I am wondering it works in 2010, but not in 2013?
I researched about that, but I could find mostly articles about "how to create new tab", etc.
Any ideas and suggestions are welcome.
This should be the fix you're looking for:
yourRibbonInstance.ActivateTab("tabID")
keep in mind that the id of the tab might not be the same as its displayed name.
Not sure if this might be overkill but you could use a macro that runs on the workbook open event to activate the sheet you want to see first..
Sub workbook_open()
Sheets("Sheet2").Activate
End Sub

Excel Cant scroll down to see sheet tabs

I upgraded to office 2007 from 2003 (I think) but now on a couple of documents I cant see all my tabs as the worksheet window goes well below the excel window. I cant move or resize the work sheet window, It's not protected. when I try click on the top bar of the worksheet window - here you would usually be able to drag it around I cant.
however if I select it in full screen mode i can see all the tabs.
I have checked the settings and "show tas" is ticked. I've googled for an hour and tried numerous things but to no avail.
If I try view as tiles It still doesn't change.
My only option left is to copy and past each sheet.. or is there a way to copy a wwhole work sheet tabs and all?
Please help!!
Thanks.
You simply need to double-click the title bar of the worksheet window. This will cause it to Maximize, which will make it fit to the exact size of the application window.
Workbook was protected. I went to review tab . took the protect workbook drop down and unselected protect.. worked as normal then!
Hope this helps someone!
Thanks!