XL97: "Cannot Shift Objects Off Sheet" Error Hiding Columns

To resolve this problem, follow these steps:

  1. Because cell comments are hidden by default, select the cell containing the comment, right-click the cell, and then click Show Comment on the shortcut menu.
  2. If the workbook is not shared, move the pointer to the edge of the comment until the pointer turns into four small black arrows. Click the comment to select the comment object. If the workbook is shared, move the pointer to the edge of the comment until the pointer turns into a white arrow pointer. Click the comment to select the comment object.
  3. On the Format menu, click Comment. In the Format Comment dialog box, click the Properties tab.
  4. Click "Move and size with cells," and then click OK.
  5. If you want to hide the cell comment again, right-click the cell and click Hide Comment on the shortcut menu.

When you hide the columns, you do not receive the error message.

 

Macro :

 1 Sub FixCanntShiftObject()

 2     Dim sh As Worksheet

 3     For Each sh In Sheets

 4         For Each c In sh.UsedRange

 5             

 6             If Not c.Comment Is Nothing Then

 7            

 8              With c.Comment.Shape

 9                  .Placement = xlMoveAndSize

10                  

11              End With

12             

13             End If

14         Next

15     Next

16     MsgBox "OK"

17 End Sub

 

你可能感兴趣的:(object)