I'm trying to develop the code to run a macro on every sheet of the workbook, except for a few named sheets. The macro is simply copying the information from each worksheet into a list on the "Summary" sheet. I am very new to VBA (as you can see from my macro below). Here is what I have so far that is not working:
Sub SUMMARY_COPY_ALL_SHEETS()
'
' SUMMARY_COPY_ALL_SHEETS Macro
'
'
Dim ws As Worksheet
For Each ws In Worksheets
' Select case is case sensitive
Select Case UCase(ws.CodeName)
Case "Project Limits"
Case "HCSS Import"
Case "SUM_STAT"
Case "SUMMARY"
'The sheets above are the sheets that I do not want to include'
Case Else
With ws
Range("B1", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Sheets("SUMMARY").Select
Range("G4").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
End With
End Select
Next ws
End Sub
I would also love to know if there is a better way of positioning the copied data onto the destination sheet. Currently, I am using the CTRL+SHIFT+DOWN method, then CTRL+SHIFT+UP, then offset one cell down to get to the right place to paste the data from the next sheet.
Thanks for any help you can give me,
Kevin
Sub SUMMARY_COPY_ALL_SHEETS()
'
' SUMMARY_COPY_ALL_SHEETS Macro
'
'
Dim ws As Worksheet
For Each ws In Worksheets
' Select case is case sensitive
Select Case UCase(ws.CodeName)
Case "Project Limits"
Case "HCSS Import"
Case "SUM_STAT"
Case "SUMMARY"
'The sheets above are the sheets that I do not want to include'
Case Else
With ws
Range("B1", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Sheets("SUMMARY").Select
Range("G4").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
End With
End Select
Next ws
End Sub
I would also love to know if there is a better way of positioning the copied data onto the destination sheet. Currently, I am using the CTRL+SHIFT+DOWN method, then CTRL+SHIFT+UP, then offset one cell down to get to the right place to paste the data from the next sheet.
Thanks for any help you can give me,
Kevin