T
tehwa
Hello,
I have a macro that formats a worksheet by looking for null cells i
Column 'A' and filling them with the previous cells data. It the
checks column 'B' for nulls and deletes the row if a null is found. Th
function I have written is working, but it is very slow:
Dim counter As Integer
Columns(1).Select
ActiveCell.CurrentRegion.Select
areaCount = Selection.Rows.Count
For counter = 1 To areaCount
If Cells(counter, 1).Value = 0 Then
Cells((counter - 1), 1).Copy _
Destination:=Cells(counter, 1)
End If
Next counter
counter = 1
For counter = areaCount To 1 Step -1
If Cells(counter, 2).Value = 0 Then
Rows(counter).Delete
End If
Next counter
This is a dodgy cut 'n' paste job, but it works when the macro is i
its full form.
Can anyone fill me in on how I can do this looping a little mor
efficiently, the other parts of the macro work fine but these ar
adding a lot of time onto the macro's execution.
Cheers,
.tehw
I have a macro that formats a worksheet by looking for null cells i
Column 'A' and filling them with the previous cells data. It the
checks column 'B' for nulls and deletes the row if a null is found. Th
function I have written is working, but it is very slow:
Dim counter As Integer
Columns(1).Select
ActiveCell.CurrentRegion.Select
areaCount = Selection.Rows.Count
For counter = 1 To areaCount
If Cells(counter, 1).Value = 0 Then
Cells((counter - 1), 1).Copy _
Destination:=Cells(counter, 1)
End If
Next counter
counter = 1
For counter = areaCount To 1 Step -1
If Cells(counter, 2).Value = 0 Then
Rows(counter).Delete
End If
Next counter
This is a dodgy cut 'n' paste job, but it works when the macro is i
its full form.
Can anyone fill me in on how I can do this looping a little mor
efficiently, the other parts of the macro work fine but these ar
adding a lot of time onto the macro's execution.
Cheers,
.tehw