Help Building Macro that Copies the same range from multiple sheets into a summary tab

dbirt31

New Member
Joined
Dec 2, 2015
Messages
3
Hello all,

I'm looking for some help after spending the last two days searching the threads for a modifiable macro to solve my current problem, and unfortunately finding myself unsuccessful.

Scenario:

I am using a different macro to copy in files from a folder into one workbook on different sheets. Once these sheets are in the workbook (300-500 sheets), I'd like to copy and paste value a range, AN1:AY111 onto a summary page (Row 1 is headers and do not to be copied again after first sheet. If this is an issue we can just do AN2:Ay111 and I can manually insert the headings later) As a result, I'd like to have one very long summary sheet with all of this data at the front of the workbook. The other tabs should remain untouched. I am using Excel 2013

I have been so close to creating one from previous posts but ran into a lot of trouble with making sure the data pasted was Paste Special - Value (Data contains formulas, so all I want is the value).

Bonus points if you can combine the two macros to insert all files from one folder (one tabbed files) into one workbook and then combine the data from the worksheets into a summary tab as mentioned above.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I found that one before and was one of the issues I was having as it seems to have a bug? For some reason whenever I run that Macro the following lines come up as a "Compile Error: Sub or Function not Defined."

and highlights "LastRow"
'Find the last row with data on the DestSh
Last = LastRow(DestSh)
 
Upvote 0
I found that one before and was one of the issues I was having as it seems to have a bug?

I along with many other individuals have used this macro by Ron before and not had any problems.

Did you look at the Example Workbook?

Also, did you paste the Common Functions required for all routines from the bottom of the page?

Code:
Function LastRow(sh As Worksheet)
    On Error Resume Next
    LastRow = sh.Cells.Find(What:="*", _
                            After:=sh.Range("A1"), _
                            Lookat:=xlPart, _
                            LookIn:=xlFormulas, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlPrevious, _
                            MatchCase:=False).Row
    On Error GoTo 0
End Function


Code:
Function LastCol(sh As Worksheet)
    On Error Resume Next
    LastCol = sh.Cells.Find(What:="*", _
                            After:=sh.Range("A1"), _
                            Lookat:=xlPart, _
                            LookIn:=xlFormulas, _
                            SearchOrder:=xlByColumns, _
                            SearchDirection:=xlPrevious, _
                            MatchCase:=False).Column
    On Error GoTo 0
End Function
 
Upvote 0
That was probably the simplest error i could have had. Thanks for helping me out and your patience, really appreciate it. Wish I knew that was the simple fix on Monday..
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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