刪除行中空格後的所有儲存格

刪除行中空格後的所有儲存格

我只是想知道是否有一種簡單的方法,對於每一行,向右移動並檢查是否有空白單元格,如果有,則刪除其右側的所有內容。這可以用公式完成嗎?

答案1

只需指定範圍然後使用巨集:

Sub Delete()   
    Range("A1:A50").Select
    Selection.ClearContents
end sub

A1:A50空白單元格後面的範圍在哪裡。

如果您反對宏,您可以透過以下方式手動完成:

1. Ctrl+G
2. Type the range in. Hit enter.
3. Then just hit the 'Delete' key.

相關內容