I’m having a issue getting the syntax right on the below few lines of code.
essentially i want Excel to remove the contents of certain ranges per row but I need to avoid cells in between those ranges which have important formulas in them. That’s why i cant use the ‘clear entire row contents’ approach
Boiled down I’d like to clear the contents of the ranges "C(e):L(e)","N(e):V(e)")
But i’m going wrong with the syntax I think
any advice on this one?
Dim e As Integer
For e = 14 To 213
If ActiveSheet.Cells(e, 35).Value = "0" Then Range("C" & "e":"L" & "e").ClearContents
>Solution :
You need to remove the quotes around the e or else it just evaluates as the text e rather than the number your referring to in the for-loop.
Dim e As Integer
For e = 14 To 213
If ActiveSheet.Cells(e, 35).Value = "0" Then Range("C" & e & ":L" & e & ",N" & e & ":V" & e).ClearContents