So to delete rows or columns you have a few ways to do it.
You can use the Range, Rows or Columns as shown below.
Columns ("A:C").delete
Rows("5:6").delete
Range("A:A").delete or
Range("1:1").delete
So lets assume you want to delete row 5 and 10 and columns E and J use the following code:
Sub HideRowsByZero()
'Update 20131107
'Declare Variables
Dim Rng As Range
Dim WorkRng As Range
'Delete Rows and Columns Before Beginning Loop
Range("A:A,J:J").delete
Range("5:5, 10:10").delete
On Error Resume Next 'If error skip to next in loop
'Define Variables
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
'Begin Loop
For Each Rng In WorkRng
If Rng.Value = "0" Then
Rng.EntireRow.Hidden = True
End If
Next
End Sub
Bookmarks