Summarizing Budgets

wootenka

New Member
Joined
Sep 29, 2011
Messages
18
I have a workbook with 30+ worksheets, one for each reporting center. I am trying to create code that will copy the full year numbers (column CD) into one summary worksheet. Each reporting center would be a column in the summary worksheet

Below is the current code. It runs and goes to the summary sheet but does not paste anything. If I hit enter, it paste random colors that I do not think are anywhere in my workbook,

Sub SummurizeSheets()
Dim ws As Worksheet

Application.ScreenUpdating = False
Sheets("Summary").Activate

For Each ws In Worksheets
If ws.Name <> "Summary" Then
ws.Range("cd1").EntireColumn.Copy
ActiveSheet.Range("b1").End(xlUp).Offset(0, 1).PasteSpecial xlPasteValues
End If
Next ws
End Sub
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
try this:

Code:
Option Explicit


Sub SummurizeSheets()
    Dim ws As Worksheet
    Dim lr As Long, l2 As Long


    Application.ScreenUpdating = False
    Sheets("Summary").Activate


    For Each ws In Worksheets
        If ws.Name <> "Summary" Then
            lr = ActiveSheet.Range("B" & Rows.Count).End(xlUp).Row + 1
            l2 = ws.Range("CD" & Rows.Count).End(xlUp).Row
            ws.Range("CD1:CD" & l2).Copy
            Sheets("Summary").Range("B" & lr).PasteSpecial xlPasteValues
        End If
    Next ws
End Sub
 
Upvote 0
Thank you. I get a Compile Error: Ambiguous name detected in the "lr = ActiveSheet.Range("B" & rows.Count).End(xlUp).Row + 1" section with rows highlighted.

Any thoughts?
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top