VBA Help - Copy data to specific sheets

Status
Not open for further replies.

quant1313

New Member
Joined
Jan 21, 2022
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I am trying to copy a specific range of data from a sheet titled "Summary Template" to any worksheet that is not titled "Summary Template" or "Priority Admin" but I am continually getting an error message. Below is the code

Sub Populate()
Dim ws As Worksheet
Dim lockedsheet As Worksheet
lockedsheet = Array("Summary Template", "Priority Admin")

Dim template As Worksheets
Set template = Worksheets("Summary Template")

For Each ws In ThisWorkbook.Sheets
If Not ws.Name = lockedsheet.Name Then
template.Range("A1:Y83").Copy
ws.Range("A2").PasteSpecial (xlPasteAll)
End If
Next ws

End Sub

Please help
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Welcome to the MrExcel board!

Duplicate to: VBA Help - Copying Data to specific sheet

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,444
Messages
6,124,891
Members
449,194
Latest member
JayEggleton

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