Recorded Macro to Paste Special Values not working

Gavin Harrison

New Member
Joined
May 2, 2017
Messages
34
Hi.

Im hoping somebody can help me, I've recorded a macro to copy a range of data and paste onto a separate tab, it involves unprotecting the workbook and unhiding the tab that the data is being copied from, then hiding it again and protecting to workbook again.

The code is copied below, but isn't copying any data, but I'm not getting any error messages.

Im using Excel for Mac 2011.

Thanks in advance.

Gavin

Sub importfri()
'
' importfri Macro
ActiveWorkbook.Unprotect
Sheets("Calculations").Visible = True
Range("AZ13:BC71").Copy
Sheets("Fri").Select
Range("A12").PasteSpecial Paste:=xlValues
Sheets("Calculations").Visible = False
Sheets("Fri").Select
ActiveWorkbook.Protect Structure:=True, Windows:=False
Range("A1:G1").Select
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
if you're attempting to copy data from the hidden sheet, you will need to select that sheet before copying data. otherwise you'd be copying data from the current sheet you're viewing.

HTH

-Matt

Code:
[COLOR=#333333]Sub importfri()[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]' importfri Macro[/COLOR]
[COLOR=#333333]ActiveWorkbook.Unprotect[/COLOR]
[COLOR=#333333]Sheets("Calculations").Visible = True
[/COLOR][B][COLOR=#333333]Sheets("Calculations").Select[/COLOR][/B]
[COLOR=#333333]Range("AZ13:BC71").Copy[/COLOR]
[COLOR=#333333]Sheets("Fri").Select[/COLOR]
[COLOR=#333333]Range("A12").PasteSpecial Paste:=xlValues[/COLOR]
[COLOR=#333333]Sheets("Calculations").Visible = False[/COLOR]
[COLOR=#333333]Sheets("Fri").Select[/COLOR]
[COLOR=#333333]ActiveWorkbook.Protect Structure:=True, Windows:=False[/COLOR]
[COLOR=#333333]Range("A1:G1").Select[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

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