ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet1.Activate vs Sheet1.Select (https://www.excelbanter.com/excel-programming/342378-sheet1-activate-vs-sheet1-select.html)

mikeburg[_46_]

Sheet1.Activate vs Sheet1.Select
 

Are there any difference between the two following lines of VBA code?

Sheet1.Activate
Sheet1.Select

In other words, are there any times they will mean something different
within the VBA code?

Thanks, mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=474813


Ron de Bruin

Sheet1.Activate vs Sheet1.Select
 
Hi Mike

If you have more sheets selected

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet2").Activate

It will activate Sheet2 ( all other sheets are still selected)


Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet2").Select

If you use select, Sheet2 is the only sheet that is selected then

--
Regards Ron de Bruin
http://www.rondebruin.nl


"mikeburg" wrote in message
...

Are there any difference between the two following lines of VBA code?

Sheet1.Activate
Sheet1.Select

In other words, are there any times they will mean something different
within the VBA code?

Thanks, mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=474813




Jim Rech

Sheet1.Activate vs Sheet1.Select
 
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet2").Activate


It will activate Sheet2 ( all other sheets are still selected)


Just one little refinement, Ron. The above is true only if there are more
than 3 sheets (in your example) in the workbook. With 3 sheets Activate is
the same a Select I believe.


--
Jim
"Ron de Bruin" wrote in message
...
| Hi Mike
|
| If you have more sheets selected
|
| Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
| Sheets("Sheet2").Activate
|
| It will activate Sheet2 ( all other sheets are still selected)
|
|
| Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
| Sheets("Sheet2").Select
|
| If you use select, Sheet2 is the only sheet that is selected then
|
| --
| Regards Ron de Bruin
| http://www.rondebruin.nl
|
|
| "mikeburg" wrote
in message
| ...
|
| Are there any difference between the two following lines of VBA code?
|
| Sheet1.Activate
| Sheet1.Select
|
| In other words, are there any times they will mean something different
| within the VBA code?
|
| Thanks, mikeburg
|
|
| --
| mikeburg
| ------------------------------------------------------------------------
| mikeburg's Profile:
http://www.excelforum.com/member.php...o&userid=24581
| View this thread:
http://www.excelforum.com/showthread...hreadid=474813
|
|
|



Ron de Bruin

Sheet1.Activate vs Sheet1.Select
 
You are correct Jim

Thanks

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jim Rech" wrote in message ...
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet2").Activate


It will activate Sheet2 ( all other sheets are still selected)


Just one little refinement, Ron. The above is true only if there are more
than 3 sheets (in your example) in the workbook. With 3 sheets Activate is
the same a Select I believe.


--
Jim
"Ron de Bruin" wrote in message
...
| Hi Mike
|
| If you have more sheets selected
|
| Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
| Sheets("Sheet2").Activate
|
| It will activate Sheet2 ( all other sheets are still selected)
|
|
| Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
| Sheets("Sheet2").Select
|
| If you use select, Sheet2 is the only sheet that is selected then
|
| --
| Regards Ron de Bruin
| http://www.rondebruin.nl
|
|
| "mikeburg" wrote
in message
| ...
|
| Are there any difference between the two following lines of VBA code?
|
| Sheet1.Activate
| Sheet1.Select
|
| In other words, are there any times they will mean something different
| within the VBA code?
|
| Thanks, mikeburg
|
|
| --
| mikeburg
| ------------------------------------------------------------------------
| mikeburg's Profile:
http://www.excelforum.com/member.php...o&userid=24581
| View this thread:
http://www.excelforum.com/showthread...hreadid=474813
|
|
|





mikeburg[_47_]

Sheet1.Activate vs Sheet1.Select
 

Thanks a bunch. I am trying to learn. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=474813



All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com