Hi everyone,
Was hoping someone out there might be able to show me more efficient way of writing some simple VBA. Current the execution is time consuming, and the example file I have posted is only a fraction of the entire ranges I need to run the Macro on.
The problem is this:
I want to create a macro whereby, if the cells in column N have values in them (or not blank), the adjacent columns O -> S are cleared. Given I am running the code over multiple spreadsheets and thousands of rows, it is taking approximately 2 mins 30 sec to execute the code. Kinda defeats the purpose of automating the task when I could do it manually in less time.
Very interested to hear your thoughts and suggestions ![Smilie](https://www.excelforum.com/images/smilies/smile.gif)
Here is my current code:
Sub clearcells()
Dim rng As Range
Set rng = Range("N4:N181")
For Each cell In rng
'test if cell is empty
If cell.Value <> "" Then
'write to adjacent cell
cell.Offset(0, 1).Value = ""
cell.Offset(0, 2).Value = ""
cell.Offset(0, 3).Value = ""
cell.Offset(0, 4).Value = ""
cell.Offset(0, 5).Value = ""
End If
Next
End Sub
Bookmarks