Hello everybody!
I have a dataset in excel containing 25684 rows and 1868 columns.
The first 6 columns all contain name identifiers for all the rows (hence, there are no empty cells in the rows for the first 6 columns). However, from column 7 onwards, since there are numerical values, many rows have missing observations. So there are rows which always contain values from column 1-6, but after column 6 they have all empty values. I want to eliminate all these rows.
I was trying to set up a Macro through VBA which deleted rows having empty cells but WITHOUT considering the first 6 columns.
I tried this, but it doesn't work (It doesn't take consider the range I want for the elimination):
SubBlank_Rows()
Dim i As Long, LastRow as Long
SetmyRange = ActiveSheet.Range("G2:BSV25684")
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = Lastrow To 1 Step -1
If WorksheetFunction.CountA(Rows(i)) = 0 Then
Rows(i).EntireRow.Delete
End If
Next i
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
Does someone know how to solve this?
Thank you very much!
O.
I have a dataset in excel containing 25684 rows and 1868 columns.
The first 6 columns all contain name identifiers for all the rows (hence, there are no empty cells in the rows for the first 6 columns). However, from column 7 onwards, since there are numerical values, many rows have missing observations. So there are rows which always contain values from column 1-6, but after column 6 they have all empty values. I want to eliminate all these rows.
I was trying to set up a Macro through VBA which deleted rows having empty cells but WITHOUT considering the first 6 columns.
I tried this, but it doesn't work (It doesn't take consider the range I want for the elimination):
SubBlank_Rows()
Dim i As Long, LastRow as Long
SetmyRange = ActiveSheet.Range("G2:BSV25684")
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = Lastrow To 1 Step -1
If WorksheetFunction.CountA(Rows(i)) = 0 Then
Rows(i).EntireRow.Delete
End If
Next i
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
Does someone know how to solve this?
Thank you very much!
O.