DanchoB

New Member
Joined
Oct 22, 2014
Messages
1
Hi everyone,

Recently I have started recording and editing macros. I am really new in this field and I am not able to find the solution for one of the latest macros I have recorded. When I run the macro below I get the following error message:

Run-Time error '1004':
Method 'ListChangesOnNewSheet' of object'_Workbook' failed

The Macro with the explanation is the following:
Sub Macro1()

'
' Macro1 Macro
'


'
1. Copy "sheet 1" to the end of the workbook


Range("CZ7:CZ9").Select
Sheets("sheet 1").Select
Sheets("sheet 1").Copy Before:=Sheets(5)

Once I have made a special copy paste of the data (cells have formulas and I want just the input)

Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False



2. I want to move this "sheet 1 (2)" to a new workbook

Sheets("sheet 1 (2)").Select
Application.CutCopyMode = False
Sheets("sheet 1 (2)").Move

3. In the new workbook I want to name the "Sheet 1 (2)" with the value in the cell "AF1" and delete the column "CZ"

ActiveSheet.Name = Range("AF1").Value
Columns("CZ:CZ").Select
Selection.Delete Shift:=xlToLeft

4. Then I want to share the workbook (for which I need to save the workbook in a generic path C:\Users\Public with the name of the active sheet)

With ActiveWorkbook .KeepChangeHistory = True
.ChangeHistoryDuration = 5000
End With
ActiveWorkbook.SaveAs Filename:="C:\Users\Public\" & ActiveSheet.Name & ".xlsx", FileFormat:= _
xlOpenXMLWorkbook, AccessMode:=xlShared

5. Finally I want to activate the option of "Highlighting Changes" and "Changes History"


With ActiveWorkbook
.SaveAs , , , , , , xlShared
.KeepChangeHistory = True
.HighlightChangesOptions When:=xlAllChanges
.ListChangesOnNewSheet = True
.HighlightChangesOnScreen = True
.Worksheets("History").Select
End With

End Sub




Any help?

Thanks
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

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