I need to retotal a variable named R. I am not sure how to do this. I need it to count backwards. So an example would be I have a spreadsheet with 14 rows in it. I am running a macro that will add another 14 rows to the original 14 rows so the new total of rows should be 28 instead of 14. I want the recount to count until the beginning cell is blank. Any help would be appreciated.
Code:
Dim myNum8 As Double
myNum8 = Application.InputBox("Do you want to delete previous cells? 1 for yes, 2 for no", Type:=1, Title:="Starting Row", Default:=2)
'Type:=1 is for number
If myNum8 = 0 Then Exit Sub
If myNum8 = 1 Then
Start = myNum1 - 6
For DLoop1 = Start To LR
Range("J" & DLoop1).Value = ""
Range("K" & DLoop1).Value = ""
Range("L" & DLoop1).Value = ""
Range("M" & DLoop1).Value = ""
Next DLoop1
For R = myNum1 To LR
'A Column Date
Range("A" & R & ":" & "A" & LR).Value = (myDate)
'B Column Test Type
Range("B" & R & ":" & "B" & LR).Value = (Test)
'C Column Work Order
Range("C" & R & ":" & "C" & LR).Value = (myNum5 & WorkOrder)
'D Column Code
If myNum2 = 1 Then Range("D" & myNum1).Value = UCase(myNum4)
If myNum3 < 4 Then Range("D" & R & ":" & "D" & LR).Value = ("PAQ3284")
If myNum3 > 3 And myNum3 < 6 Then Range("D" & R & ":" & "D" & LR).Value = ("PAQ3000")
'F Column Pass
Range("F" & R & ":" & "F" & LR).Value = ("1")
'H Column totals
Range("H" & R & ":" & "H" & R).Formula = "=F" & R & "+G" & R
Next R
End If
'Sum Function for H Column
'Recount Total Column
'If myNum8 = 1 Then
'Do Until ActiveCell.Value = Empty
'ActiveCell.Offset(1, 0).Select
'RecCount = RecCount - 1
'Loop