ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sub to freeze all sheets & delete all comments (https://www.excelbanter.com/excel-programming/432449-sub-freeze-all-sheets-delete-all-comments.html)

Max

Sub to freeze all sheets & delete all comments
 
Hunting for a sub to freeze all sheets (copy entire sheetpaste special as
values) & delete all comments (in all sheets) in a book. Thanks.

joel

Sub to freeze all sheets & delete all comments
 
For Each sht In Sheets
sht.Cells.Copy
sht.Cells.PasteSpecial past:=xlPasteValues

Next sht


"Max" wrote:

Hunting for a sub to freeze all sheets (copy entire sheetpaste special as
values) & delete all comments (in all sheets) in a book. Thanks.


Charabeuh[_3_]

Sub to freeze all sheets & delete all comments
 
Something like that :?

--------------------------------------------------------------
Sub PastValDelComments()
Dim dlgAnswer As Boolean, S As String
Dim OldName As String, NewName As String
Dim xWs As Worksheet
dlgAnswer = False

' SAVE workbook with another name or path
S = "SECURITY : save your worbook with another name, please" & vbCrLf
S = S & vbCrLf & " == with another Name or Path <=="
OldName = ThisWorkbook.Path & "\" & ThisWorkbook.Name

While Not dlgAnswer Or (OldName = NewName)
MsgBox S
dlgAnswer = Application.Dialogs(xlDialogSaveAs).Show
NewName = ThisWorkbook.Path & "\" & ThisWorkbook.Name
Wend

For Each xWs In Worksheets
xWs.Cells.Copy
xWs.Cells.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
xWs.Cells.ClearComments
Next xWs

ThisWorkbook.Save

End Sub
--------------------------------------------------------------





"Max" a écrit dans le message de
...
Hunting for a sub to freeze all sheets (copy entire sheetpaste special as
values) & delete all comments (in all sheets) in a book. Thanks.



Max

Sub to freeze all sheets & delete all comments
 
Many thanks, Charabeuh!
That works fine.



Max

Sub to freeze all sheets & delete all comments
 
Thanks, Joel. I got what I was looking for from Charabeuh's response.




All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com