Why Vba Code To Combine Multiple Spreadsheets Into One Work On The Author’s Video BUT Does Not Work Here

Turk182

Board Regular
Joined
Sep 9, 2009
Messages
66
Office Version
  1. 365
Platform
  1. MacOS
Sub Consolidate()

Dim LR, LC As Long
Dim sht As Worksheet
Dim wrk As Workbook

Set wrk = ActiveWorkbook

For Each sht In wrk.Worksheets
If sht.Name <> "Master" Then
sht.Select
LR = ActiveSheet.Range("A300").End(xlUp).Row
LC = ActiveSheet.Range("XFD1").End(xlToLeft).Column
ActiveSheet.Range(Cells(2, 1), Cells(LR, LC)).Copy
Sheets("Master").Select
LR_M = ActiveSheet.Range("A300").End(xlUp).Row + 1

MsgBox "Paste to Master"


End If

Next sht
End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
what exactly do you mean by it doesnt work. Does it error somewhere? If so where?, Does it behave differently than expected? or does it simply do nothing?
 
Upvote 0
The issue has been resolved; thank you for replying though.?
 
Upvote 0

Forum statistics

Threads
1,215,527
Messages
6,125,337
Members
449,218
Latest member
Excel Master

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