Hi guys,
I have many thousands of rows of data and I was wondering is it possible to create a macro or a piece of vba code to insert a blank row everytime the value in a cell is less than zero, the blank row should be above the less than zero cell.
This was the best I could come up with but no joy:
[pre]
[/pre]
Hopefully someone here with more va experiance than me can help?
Thanks in advance for any help.
Here is the work book so you know what I'm talking about;
https://rapidshare.com/files/3197595994/Book2.xlsm
I have flagged the negative values in red using conditional formating to make it clearer and have inserted blank rows manualy for the 1st few times so you can see what I'm trying to do.
I have many thousands of rows of data and I was wondering is it possible to create a macro or a piece of vba code to insert a blank row everytime the value in a cell is less than zero, the blank row should be above the less than zero cell.
This was the best I could come up with but no joy:
[pre]
Code:
Sub gaps()
For a = 1 To ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
If ActiveSheet.Cells(a, 1).Value < 0 Then
ActiveSheet.Rows(a + 1).Insert
a = a + 1
End If
Next a
End Sub
Hopefully someone here with more va experiance than me can help?
Thanks in advance for any help.
Here is the work book so you know what I'm talking about;
https://rapidshare.com/files/3197595994/Book2.xlsm
I have flagged the negative values in red using conditional formating to make it clearer and have inserted blank rows manualy for the 1st few times so you can see what I'm trying to do.