I have a piece of code that has been working for more than 3 years. Suddenly, on July 28, 2016, he stopped working.
It is very simple, and I hope it is easy to solve (or perhaps a Microsoft update broke it)
ThisWorkbook.Sheets(1).Select ThisWorkbook.Sheets(2).Select (False) ' like holding ctrl
This will always select sheet # 1 and sheet # 2. Now it seems that "(False)" is not working, and it will only select sheet # 1. I tried this on 5 different computers (all Excel 2013) Please let me know what happens.
Thanks! -Mike
Edit: This also does not work anymore. As Jordan said in the comments, this is simply not being implemented.
y = 9 ThisWorkbook.Sheets(1).Select For y = 2 To x ThisWorkbook.Sheets(y).Select (False) ' like holding ctrl Next y
edit2: Since there seems to be no final answer, I will ask if anyone can help me with the workaround:
ThisWorkbook.Sheets(Array(1 to x)).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ FolderName & "\" & QuoteFilename, Quality:=xlQualityStandard, IncludeDocProperties:=True, _ IgnorePrintAreas:=False, OpenAfterPublish:=False
Obviously this will not work, but it should get my point.
DECISION:
Thanks to Ralph, I made some passages and created this:
Private Sub Tester() x = 5 ReDim SheetstoSelect(1 To x) As String For y = 1 To x SheetstoSelect(y) = ThisWorkbook.Sheets(y).Name Next y ThisWorkbook.Sheets(SheetstoSelect).Select End Sub
This selects the actual sheet No. 1-5 and allows you to define the sheets for selection according to their actual sheet order.
I still don't know the root of the original problem, but workarounds are just as good.