Clear contents of cells in VBA using column reference

后端 未结 8 1934
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 22:31

I am trying to get a piece of code to clear the data in some cells, using the column references. I am using the following code:

Worksheets(sheetname).Range(.         


        
8条回答
  •  情深已故
    2021-01-01 23:25

    You can access entire column as a range using the Worksheet.Columns object

    Something like:

    Worksheets(sheetname).Columns(1).ClearContents 
    

    should clear contents of A column

    There is also the Worksheet.Rows object if you need to do something similar for rows


    The error you are receiving is likely due to a missing with block.

    You can read about with blocks here: Microsoft Help

提交回复
热议问题