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