J
Janis
The macro without the comments works, the problem is when I delete the first
row while testing I noticed if I run the macro a second time I get an error
since the row is already deleted. Since the user could run it twice
accidentally, I decided to put some error checking to make sure that first
row holds a date before I delete that pesky date row. I want to save the
date variables and put them in later.
I have a problem with the Else block. I want the if block to go down to the
else statement but it thinks it is over with the if then line. I want the
then part to extend all the way to the else.
thanks,
Sub deleteDateRow1()
Dim FrReptDate As Date
Dim ToReptDate As Date
Dim Rng As Range
Rng = Range("A1")
If Rng.Value.Date Then FrReptDate = Rng.Value
'With Range("A1")
'FrReptDate = .Value
ToReptDate = Rng.Offset(0, 1).Value
Rng.EntireRow.Delete Shift:=xlUp
'End With
Debug.Print FrReptDate, ToReptDate
Else
Exit Sub
End Sub
row while testing I noticed if I run the macro a second time I get an error
since the row is already deleted. Since the user could run it twice
accidentally, I decided to put some error checking to make sure that first
row holds a date before I delete that pesky date row. I want to save the
date variables and put them in later.
I have a problem with the Else block. I want the if block to go down to the
else statement but it thinks it is over with the if then line. I want the
then part to extend all the way to the else.
thanks,
Sub deleteDateRow1()
Dim FrReptDate As Date
Dim ToReptDate As Date
Dim Rng As Range
Rng = Range("A1")
If Rng.Value.Date Then FrReptDate = Rng.Value
'With Range("A1")
'FrReptDate = .Value
ToReptDate = Rng.Offset(0, 1).Value
Rng.EntireRow.Delete Shift:=xlUp
'End With
Debug.Print FrReptDate, ToReptDate
Else
Exit Sub
End Sub