I’m trying to clear contents on row and columns when there is a 0 found.
I’m able to write out a code to clear them, but I can only vary the row. My column is fixed and it starts to get a little lengthy after i add in more of similar codes to consider columns A to Z.
My codes is as follows
Sub Macro1()
Dim columnval As Long, k As Long
For k = 5 To 6
If (Range("A" & k)) = 0 Then
Range("A" & k).ClearContents
End If
Next k
For k = 5 To 6
If (Range("B" & k)) = 0 Then
Range("B" & k).ClearContents
End If
Next k
End Sub
The code is working, just that it gets too lengthy when comes to column Z. If you have a better way, do share it with me! Thanks!
Here is the shortest and the fastest way to achieve what you want.
FOLLOW UP
Sid