Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How do I use vb to move from worksheet to worksheet in a workbook.

I am using VB (Excel) and want to be able to move from sheet to sheet in a
macro and finish at the last sheet. Any ideas??
  #2   Report Post  
Posted to microsoft.public.excel.programming
job job is offline
external usenet poster
 
Posts: 65
Default How do I use vb to move from worksheet to worksheet in a workbook.



For Each wksht In ActiveWorkbook.Worksheets...

HTH,

Job

"Ed123" wrote in message
...
I am using VB (Excel) and want to be able to move from sheet to sheet in a
macro and finish at the last sheet. Any ideas??



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How do I use vb to move from worksheet to worksheet in a workbook.

If you don't need to actually select the sheets, use something
like

Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
' do something with WS
Next WS

If you do need to select the sheets, put a Select statement
within the loop above:
WS.Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Ed123" wrote in message
...
I am using VB (Excel) and want to be able to move from sheet to
sheet in a
macro and finish at the last sheet. Any ideas??



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I use vb to move from worksheet to worksheet in a workbook.

With ActiveWorkbook
for each sh in .Worksheets
msgbox "in sheet: " & sh.Name & vbNewLine & _
"cell A1: " & sh.Range("A1").Value
Next
.Worksheets(.Worksheets.count).Select
End With

--
Regards,
Tom Ogilvy

"Ed123" wrote in message
...
I am using VB (Excel) and want to be able to move from sheet to sheet in a
macro and finish at the last sheet. Any ideas??



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
move a worksheet from one workbook to another Wizard475 Excel Discussion (Misc queries) 1 February 13th 09 07:50 PM
Why can't you just Move a worksheet in Excel '07 to new workbook? Rania Excel Worksheet Functions 1 November 15th 07 08:51 PM
Copy/Move Worksheet from one Workbook to another Anney Excel Discussion (Misc queries) 3 December 15th 06 12:42 PM
How do I move the worksheet tabs to the top of the workbook? Deborah Green Excel Discussion (Misc queries) 10 February 16th 06 03:21 PM
command button move worksheet from one workbook to another Qaspec Excel Programming 3 February 2nd 05 12:55 PM


All times are GMT +1. The time now is 07:15 AM.

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

About Us

"It's about Microsoft Excel"