Recorded Macro to Paste Special Values not working

Gavin Harrison

New Member
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
 

hateme28

Board Regular
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:

Some videos you may like

This Week's Hot Topics

Top