#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Cyclic copy

Hello
I have a file with several sheets. Every sheet has its name, like home;
job; etc.
I need to copy into a new sheet all sheet names and cell.
For example: I need in cell b2, sheet1 name; in cell b3, sheet2 name; in
cell b4, sheet3 name, etc.
Then, I need, in cell c2, sheet1 cell b9 data, in cell c3, sheet2 cell b9
data, in cell c4, sheet3 cell b9 data, etc.
I think this can be done thought a cyclic code. I cant create this code.
So, any help is most welcome.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Cyclic copy

Try this macro. Paste this code in a VBA module in your workbook:

Sub ListSheets()
'Lists all the worksheets in the current workbook.
'Declare variables for this macro.
Dim xx As Integer, NewWS As Worksheet
On Error GoTo LSerr1
'Add a new worksheet
Set NewWS = ActiveWorkbook.Sheets.Add(after:=Worksheets(Worksh eets.Count))
For xx% = 1 To (Sheets.Count - 1)
NewWS.Cells(xx% + 1, 1).Value = Sheets(xx%).Name
NewWS.Cells(xx% + 1, 2).Value = Sheets(xx%).Range("B9").Value
Next xx%
'Done. Add headings for the output rows
NewWS.Cells(1, 1).Value = "Sheets in " & ActiveWorkbook.Name
LS_CleanUp:
Set NewWS = Nothing
Exit Sub
LSerr1:
MsgBox "Could not list sheets", vbExclamation, "ListSheets error"
GoTo LS_CleanUp
End Sub

To run it, select Tools Macro Macros. Select ListSheets, then click Run.

If you are new to macros, this Jon Peltier link may be helpful:
http://peltiertech.com/WordPress/200...e-elses-macro/

Hope this helps,

Hutch

"Raul Sousa" wrote:

Hello
I have a file with several sheets. Every sheet has its name, like home;
job; etc.
I need to copy into a new sheet all sheet names and cell.
For example: I need in cell b2, sheet1 name; in cell b3, sheet2 name; in
cell b4, sheet3 name, etc.
Then, I need, in cell c2, sheet1 cell b9 data, in cell c3, sheet2 cell b9
data, in cell c4, sheet3 cell b9 data, etc.
I think this can be done thought a cyclic code. I cant create this code.
So, any help is most welcome.

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
Average cyclic error Kent Excel Worksheet Functions 5 December 26th 09 02:05 PM
Graphing cyclic data Rick Excel Discussion (Misc queries) 6 March 25th 08 06:53 PM
Display Cyclic Error as Blank ? Raj Excel Programming 2 September 14th 06 09:47 PM
How do I correct a cyclic redundancy check error Jeff Excel Discussion (Misc queries) 1 March 25th 05 06:09 PM
cyclic redundancy check ron Excel Programming 1 October 15th 03 01:03 AM


All times are GMT +1. The time now is 11:41 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"