Procedure Too Big

wayneshirley

Board Regular
Joined
Jun 23, 2003
Messages
140
Hi there,

I am getting an error message "procedure too big." My macro is in Excel 1997-2003 format.

I have commented out as much unnecessary code as I can find.

Is there anything else i can do?

Thank you.
 
An array is like grouping sheets together. Sample below

Sub mcrArray()
'A sheet Arrary is like grouping
'You can adjust all the sheets in the group
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Range("A1").Select
End Sub

And

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> PageSetupArraySheets()<br><SPAN style="color:#00007F">Dim</SPAN> wsH <SPAN style="color:#00007F">As</SPAN> Worksheet<br> <br><SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> wsH <SPAN style="color:#00007F">In</SPAN> ActiveWorkbook.Worksheets<br>    <SPAN style="color:#00007F">With</SPAN> wsH.PageSetup<br>        .CenterHorizontally = <SPAN style="color:#00007F">False</SPAN><br>        .CenterVertically = <SPAN style="color:#00007F">False</SPAN><br>        .Orientation = xlPortrait<br>        .Zoom = 100<br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br><SPAN style="color:#00007F">Next</SPAN> wsH<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Perhaps looping through the sheets would do what you want to create the formula and then fill down. Like this:

Sub loopArray()
Dim lastrow As Long
Dim wsH As Worksheet
For Each wsH In Worksheets
wsH.Activate
Range("M2").FormulaR1C1 = "=SUM(RC[-5]:RC[-1])"
Range("M2").Select
lastrow = Range("L" & Rows.Count).End(xlUp).Row
Range("M2").AutoFill Destination:=Range("M2:M" & lastrow), Type:=xlFillDefault
Next wsH
End Sub
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi Trevor,

I will try to run this code. Thank you for the guidance on arrays - I have copied this down for future reference.

The totals on each sheet will be on different rows.

Thanks for everything, really appreciate it!

Wayne.
 
Upvote 0

Forum statistics

Threads
1,225,157
Messages
6,183,249
Members
453,152
Latest member
ChrisMd

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