Pat_The_Bat
Board Regular
- Joined
- Jul 12, 2018
- Messages
- 83
Hi Friends,
I am writing a macro that resets the sheets I'm working with. On one page it simply clears contents of the columns I use, but on the other sheet I need to actually delete all rows except for the ones I've defined.
So I want to delete all rows from row 2 down to LstRow
But don't delete the following rows :
IncomeHDRAK
HDRAK2
HDRAK3
HDRAK4
HDRAK5
I am writing a macro that resets the sheets I'm working with. On one page it simply clears contents of the columns I use, but on the other sheet I need to actually delete all rows except for the ones I've defined.
So I want to delete all rows from row 2 down to LstRow
But don't delete the following rows :
IncomeHDRAK
HDRAK2
HDRAK3
HDRAK4
HDRAK5
Code:
Dim IncomeHDR As Integer
Dim HDRAK2 As Integer
Dim HDRAK3 As Integer
Dim HDRAK4 As Integer
Dim HDRAK5 As Integer
With Sheets("Doc Request")
.Range("B4:B499").ClearContents
.Range("Z4:Z499").ClearContents
End With
Sheets("Doc List").Activate
With Sheets("Doc List")
Set IncomeHDRAK = Range("AK1:AK5").Find("Income")
IncomeHDR = IncomeHDRAK.Row
Debug.Print IncomeHDR
Set HDRAK2 = Range("AK:AK").Find("ASSET")
HDR2 = HDRAK2.Row
Debug.Print HDR2
Set HDRAK3 = Range("AK:AK").Find("REO")
HDR3 = HDRAK3.Row
Debug.Print HDR3
Set HDRAK4 = Range("AK:AK").Find("Credit")
HDR4 = HDRAK4.Row
Debug.Print HDR4
Set HDRAK5 = Range("AK:AK").Find("Other")
HDR5 = HDRAK5.Row
Debug.Print HDR5
Dim LstRow2 As Integer
LstRow2 = Range("F" & .Rows.Count).End(xlUp).Row
Debug.Print LstRow
End With