I have had a piece of code in operation for over 3 years. Suddenly on July 28th, 2016, it stopped working.
It is very simple and I hope it is an easy solve (or maybe a Microsoft update broke it)
ThisWorkbook.Sheets(1).Select
ThisWorkbook.Sheets(2).Select (False) ' like holding ctrl
This would always selects Sheet #1 AND Sheet #2. Now it seems that the "(False)" doesn't work and it will only select Sheet #1. I have tried this on 5 different computers (all Excel 2013) Please let me know what is going on.
Thanks! -Mike
Edit: This also doesn't work anymore. Like Jordan said in the comments, it just does not execute.
y = 9
ThisWorkbook.Sheets(1).Select
For y = 2 To x
ThisWorkbook.Sheets(y).Select (False) ' like holding ctrl
Next y
edit2: Since there doesn't seem to be a definitive answer I will ask if somebody can help me with a workaround:
ThisWorkbook.Sheets(Array(1 to x)).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
FolderName & "\" & QuoteFilename, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Obviously this does not work, but it should get my point across.
SOLUTION:
Thanks to Ralph, I took some excerpts 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# from 1-5 and allows defining sheets to select by their actual sheet order.
Still don't know the root of the initial issue, but workarounds are just as good.