Macro executing (copy data) from at sett of sheets in the workbook

S

Snoopy

Hey guys
My workbook [REPORT.XLSM] contains a number of sheets;
Rev01 ..Rev02..Rev03... and so on.
The workbook will expand with new revision sheet RevN+1 occasionally.
I want to copy a range of data (same range in every single sheet) in
all revisions (sheets beginning with "Rev"), and paste the data (only
values) into one new sheet called "Total".
My workbook contains also sheets with other names - not beginning
wirth "Rev"

What kind of macro-loop program will do the job moving from one sheet
to the next beginning with"Rev" and stop after the last one.

Best regards
Snoopy
 
D

Don Guillett

Should get you started

Sub foreacREVsheet()
For i = 1 To Sheets.Count
If LCase(Left(Sheets(i).Name, 3)) = "rev" Then
MsgBox Sheets(i).Range("a1")
End If
Next i
End Sub
 
N

Nils Morten

Should get you started

Sub foreacREVsheet()
For i = 1 To Sheets.Count
If LCase(Left(Sheets(i).Name, 3)) = "rev" Then
MsgBox Sheets(i).Range("a1")
End If
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software



Hey guys
My workbook [REPORT.XLSM] contains a number of sheets;
Rev01 ..Rev02..Rev03... and so on.
The workbook will expand with new revision sheet RevN+1 occasionally.
I want to copy a range of data (same range in every single sheet)  in
all revisions (sheets beginning with "Rev"), and paste the data (only
values) into one new sheet called "Total".
My workbook contains also sheets with other names - not beginning
wirth "Rev"
What kind of macro-loop program will do the job moving from one sheet
to the next beginning with"Rev" and stop after the last one.
Best regards
Snoopy– Skjul sitert tekst –

– Vis sitert tekst –

Thanks Don ! :)
Magnificent!
Regards Snoopy
 
D

Don Guillett

As always, post your final for the archives


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
Should get you started

Sub foreacREVsheet()
For i = 1 To Sheets.Count
If LCase(Left(Sheets(i).Name, 3)) = "rev" Then
MsgBox Sheets(i).Range("a1")
End If
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software



Hey guys
My workbook [REPORT.XLSM] contains a number of sheets;
Rev01 ..Rev02..Rev03... and so on.
The workbook will expand with new revision sheet RevN+1 occasionally.
I want to copy a range of data (same range in every single sheet) in
all revisions (sheets beginning with "Rev"), and paste the data (only
values) into one new sheet called "Total".
My workbook contains also sheets with other names - not beginning
wirth "Rev"
What kind of macro-loop program will do the job moving from one sheet
to the next beginning with"Rev" and stop after the last one.
Best regards
Snoopy– Skjul sitert tekst –

– Vis sitert tekst –

Thanks Don ! :)
Magnificent!
Regards Snoopy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top