Hi all:
My problem looks simple, but some how it takes considerable time to delete range of columns based on condition. Here is situation:
I have data in columns H, I, J & K. from row 12 to 50. In column I is input and other columns are calculated fields, I keep adding/deleting data in column I. I want VBA macro, if any cell in column I12:I50 is empty then delete data from relevant cells from other Columns (H12:H50, J12:J50 & K12:K50). So far I have VBA code that works but it takes considerable time to do the process. I am looking better/faster solution. Using excel 2003.
Here is my code:
Any help with faster solution is appreciated. Right now I can delete manually way faster than vba macro.
Thanks,
Ria
My problem looks simple, but some how it takes considerable time to delete range of columns based on condition. Here is situation:
I have data in columns H, I, J & K. from row 12 to 50. In column I is input and other columns are calculated fields, I keep adding/deleting data in column I. I want VBA macro, if any cell in column I12:I50 is empty then delete data from relevant cells from other Columns (H12:H50, J12:J50 & K12:K50). So far I have VBA code that works but it takes considerable time to do the process. I am looking better/faster solution. Using excel 2003.
Here is my code:
Code:
Sub Condition_Delete()
Dim LR As Long
Set sh = ActiveSheet
Application.ScreenUpdating = False
For i = 14 To 50 '===LR
If Cells(i, "I") = "" Then
sh.Cells(i, "H").ClearContents
sh.Cells(i, "J").ClearContents
sh.Cells(i, "K").ClearContents
End If
Next i
Application.ScreenUpdating = True
End Sub
Thanks,
Ria