Selecting Specific Sheets
Right you are (Memo to self: New glasses immediately!).
/ Tyla /
On Feb 28, 11:38 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
I think you have the request backwards... As per the OP..."The two that I
don't want selected are Sheet1 and the very last one"... Those are the only
two sheets your code selects.
--
HTH...
Jim Thomlinson
" wrote:
I suspect a one-line would do the job. Try this:
Sheets(Array(Sheets(1).Name, Sheets(Worksheets.Count).Name)).Select
The definition of "first" and "very last" can get odd inExcel. This
code picks the left-most and right-most tabs within the workbook.
HTH
/Tyla/
On Feb 28, 11:12 am, wrote:
I am trying to have all but two sheets selected out of a varying
number of possible sheets. The two that I don't want selected are
Sheet1 and the very last one (SheetX for example).
So far I have used this code below, but it only gets me half way there
(doesn't select the first sheet, but still has the last one selected
with the rest of the group).
Dim shCount As Integer
ThisWorkbook.Worksheets(2).Select
For shCount = 3 To ThisWorkbook.Worksheets.Count
Worksheets(shCount).Select (False)
Next shCount
For Each ws In Worksheets
Next ws
Any other ideas?
|