Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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
|
|
|


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
|
|
|




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
=[Book.xls]Sheet1!A1 and not c:\blah\=[Book.xls]Sheet1!A1 Gaijintendo Excel Discussion (Misc queries) 1 August 7th 08 09:29 AM
[=Sheet1!A1] - if i use Column A1 ('Sheet1') / A2 ('Sheet2') Lawrence C H Tan Excel Worksheet Functions 0 January 19th 07 08:29 PM
Sheet1$A1:A1 vs Sheet1$ [email protected] Excel Programming 1 May 27th 05 11:52 PM
Why Sheet1 is displayed in modules as sheet1 Jim at Eagle Excel Programming 2 April 22nd 05 03:09 PM
Sheet1 object not Worksheets("Sheet1") onedaywhen Excel Programming 2 August 12th 03 12:38 PM


All times are GMT +1. The time now is 10:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"