How to select and delete every 3rd column

后端 未结 3 1646
长发绾君心
长发绾君心 2021-01-14 15:56

I have a set of data where every third column is the same. I want to leave only the first column and other which are the same must be deleted.

At first I tried this

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-14 16:16

    You can go backwards like this. Also, you don't need to select the column before deleting, you can simply delete it right away.

    For i = ((LastColumn \ 4) * 4) To 4 Step -4
       ws.Columns(i).Delete Shift:=xlToLeft
    Next i
    

提交回复
热议问题