Skill<Ambition
New Member
- Joined
- Oct 18, 2013
- Messages
- 3
Right out of the gate let me start by saying I’m no pro at this stuff. I’m really just a beginner with lofty ambitions and incremental growth in skill… Hence the post here… </SPAN>
My Problem:</SPAN>
I have a data set of an indeterminate amount of rows. It can be large. It can be small. It all depends on how long (date) the report range is. </SPAN>
The data comes back in rows—if you didn’t catch that earlier—with column headers. </SPAN>
My task is inserting a blank (empty) row between each row of data and for Columns “J” through “BB” calculate the difference between the cell above and the cell below the newly created empty cell/row. If the value is < > “0.00” it should highlight the cell Yellow. </SPAN>
I want this task to continue to the bottom of the data set in that column, and all the way to column “BB.” </SPAN>
The issue I’m running into is that the loop is stopping on the first empty cell in one of the new rows I’ve created. I’m not sure how to get it to loop to the bottom of the column where there is actually no more data. </SPAN>
Any thoughts? Code is copied below. No pocking fun of me…
I’m just a newbie. I’m sure this code looks like crap… </SPAN>
'Adding New Rows
Dim r As Integer, Count As Integer
Application.ScreenUpdating = False
Count = Range("a65536").End(xlUp).Row
For r = Count To 1 Step -1 ' work backwards to account for added lines
If Cells(r, 1) <> vbNullString Then ' skip blank lines
ActiveSheet.Rows(r + 1).Insert
End If
Next r
Application.ScreenUpdating = True
'Hidden Top Row (Row 2)--to keep it from cacl the column header with a number value
Rows("2:2").Select
Selection.EntireRow.Hidden = True
'Differences Calc
Range("j4").Select
Do Until ActiveCell.Value = ""
Dim i As Currency
i = ActiveCell.Select
ActiveCell.FormulaR1C1 = "=R[1]C-R[-1]C"
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
Formula1:="0.00"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:="0.00"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
ActiveCell.Offset(2, 0).Select
Loop
End Sub
My Problem:</SPAN>
I have a data set of an indeterminate amount of rows. It can be large. It can be small. It all depends on how long (date) the report range is. </SPAN>
The data comes back in rows—if you didn’t catch that earlier—with column headers. </SPAN>
My task is inserting a blank (empty) row between each row of data and for Columns “J” through “BB” calculate the difference between the cell above and the cell below the newly created empty cell/row. If the value is < > “0.00” it should highlight the cell Yellow. </SPAN>
I want this task to continue to the bottom of the data set in that column, and all the way to column “BB.” </SPAN>
The issue I’m running into is that the loop is stopping on the first empty cell in one of the new rows I’ve created. I’m not sure how to get it to loop to the bottom of the column where there is actually no more data. </SPAN>
Any thoughts? Code is copied below. No pocking fun of me…

'Adding New Rows
Dim r As Integer, Count As Integer
Application.ScreenUpdating = False
Count = Range("a65536").End(xlUp).Row
For r = Count To 1 Step -1 ' work backwards to account for added lines
If Cells(r, 1) <> vbNullString Then ' skip blank lines
ActiveSheet.Rows(r + 1).Insert
End If
Next r
Application.ScreenUpdating = True
'Hidden Top Row (Row 2)--to keep it from cacl the column header with a number value
Rows("2:2").Select
Selection.EntireRow.Hidden = True
'Differences Calc
Range("j4").Select
Do Until ActiveCell.Value = ""
Dim i As Currency
i = ActiveCell.Select
ActiveCell.FormulaR1C1 = "=R[1]C-R[-1]C"
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
Formula1:="0.00"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:="0.00"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
ActiveCell.Offset(2, 0).Select
Loop
End Sub