Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default moving from sheet to sheet

I need to write code that automatically moves from sheet to sheet and gathers
data. I have no problem gathering the data on the sheet but I don't know how
to move the pointer to the next sheet in the workbook.
I would really appreciate any help you can give.
--
Bob A
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default moving from sheet to sheet

Sub moveSheetToSheet()
Dim ws As Worksheet

For Each ws In ThisWorkbook.Sheets
MsgBox ws.Name
Next
End Sub

"Bob A" wrote:

I need to write code that automatically moves from sheet to sheet and gathers
data. I have no problem gathering the data on the sheet but I don't know how
to move the pointer to the next sheet in the workbook.
I would really appreciate any help you can give.
--
Bob A

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default moving from sheet to sheet

Are you wanting to loop thru sheets? You can use this.

Sub LoopSheets()

Dim wks As Worksheet

For Each wks In Worksheets
wks.Activate
'do something
Next wks
End Sub

If you are just wanting to activate the next sheet you can explicitly
reference the sheet.

Sheets("Sheet2").Activate
--
Cheers,
Ryan


"Bob A" wrote:

I need to write code that automatically moves from sheet to sheet and gathers
data. I have no problem gathering the data on the sheet but I don't know how
to move the pointer to the next sheet in the workbook.
I would really appreciate any help you can give.
--
Bob A

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default moving from sheet to sheet

Hi,

There are several ways, this loops through an array of named sheets

Sub Sonic()
Dim V As Variant
Dim S As String
Dim sh As Worksheet
S = "Sheet1,Sheet2,Sheet3"
V = Split(S, ",")
For Each sh In ThisWorkbook.Worksheets
If Not IsError(Application.Match(CStr(sh.Name), V, 0)) Then
'do things
MsgBox sh.Name
End If
Next sh
End Sub


Mike

"Bob A" wrote:

I need to write code that automatically moves from sheet to sheet and gathers
data. I have no problem gathering the data on the sheet but I don't know how
to move the pointer to the next sheet in the workbook.
I would really appreciate any help you can give.
--
Bob A

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default moving from sheet to sheet

wow, thank you VERY much for your great help!
--
Bob A


"Mike H" wrote:

Hi,

There are several ways, this loops through an array of named sheets

Sub Sonic()
Dim V As Variant
Dim S As String
Dim sh As Worksheet
S = "Sheet1,Sheet2,Sheet3"
V = Split(S, ",")
For Each sh In ThisWorkbook.Worksheets
If Not IsError(Application.Match(CStr(sh.Name), V, 0)) Then
'do things
MsgBox sh.Name
End If
Next sh
End Sub


Mike

"Bob A" wrote:

I need to write code that automatically moves from sheet to sheet and gathers
data. I have no problem gathering the data on the sheet but I don't know how
to move the pointer to the next sheet in the workbook.
I would really appreciate any help you can give.
--
Bob A



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default moving from sheet to sheet

Do you see a "YES" button next to Was this post helpful to you?
Someone told me that they don't see it so they can't give credit to those
that help with code. I saw your reply about "Thanks" but not check mark by
our names. I'm just curious.


--
Cheers,
Ryan


"Bob A" wrote:

wow, thank you VERY much for your great help!
--
Bob A


"Mike H" wrote:

Hi,

There are several ways, this loops through an array of named sheets

Sub Sonic()
Dim V As Variant
Dim S As String
Dim sh As Worksheet
S = "Sheet1,Sheet2,Sheet3"
V = Split(S, ",")
For Each sh In ThisWorkbook.Worksheets
If Not IsError(Application.Match(CStr(sh.Name), V, 0)) Then
'do things
MsgBox sh.Name
End If
Next sh
End Sub


Mike

"Bob A" wrote:

I need to write code that automatically moves from sheet to sheet and gathers
data. I have no problem gathering the data on the sheet but I don't know how
to move the pointer to the next sheet in the workbook.
I would really appreciate any help you can give.
--
Bob A

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
formula for moving information from one sheet to another sheet Puzzled Excel Discussion (Misc queries) 4 June 6th 10 05:58 AM
moving from one sheet to another from a cell of a sheet mah1608 Excel Worksheet Functions 1 May 8th 09 06:27 AM
moving informatiion from one sheet to a total sheet john Excel Discussion (Misc queries) 2 January 31st 08 10:17 PM
Moving to Next Sheet [email protected] Excel Programming 1 September 26th 06 07:19 PM
Inserting a row in sheet A should Insert a row in sheet B, removing a row in Sheet A should remove the corresponding row in sheet B Hannes Heckner Excel Programming 1 March 5th 04 09:10 AM


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

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"