VBA TIPS
What is the difference between Activate and Select?

Sheets(1).Activate and Sheets(1).Select looks like doing the exactly same thing.

Although, the code Sheets(1).Select fails when the worksheet is invisible.

As for Activate method, it works. The workbook as the parent object is activeted. Activate is a method for activating objects.
Select is a method for selecting objects.

You can select plural worksheets but cannot activate both worksheet. Only you can do is activate a worksheet.

Example

Place the following in a worksheet module.

Option Explicit


Sub Test1()
'Works
    ActiveWorkbook.Sheets(Array(1, 2, 3)).Select
End Sub


Sub Test2()
'does not work
    ActiveWorkbook.Sheets(Array(1, 2, 3)).Activate
End Sub



| HOME |
Copyright © cellmasters.net - colo's junk room All Right Reserved
ABOUT
WORKS
THE CELL MASTERS
CONTACT
LINKS
Tips and Information about Microsoft Excel|Masaru Kaji aka Colo