Hello Everyone,
I have a pretty basic question. I thought I had this mastered, guess not.
Basically, a program I have has hard coded Rows 1:50 to delete. Problem is that depending on the variable selection in the data set, there could be more than 50 rows that need deleting. Thankfully, there is a BLANK row before the data set begins.
I have been using the following code, but it selects rows all the way to the bottom of the data set 1300 rows or so.
Sub DeleteData()
Dim LastRow As Long
Dim LastCol As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
ActiveSheet.UsedRange.Select
ActiveSheet.Rows("1:" & LastRow).Delete
Selection.Delete Shift:=xlUp
End Sub
I have all reference values in colum "A", I just don't understand why this code doesn't select row 1:50 only, since A51 is blank....
Please help. I have attached a (reduced data set) file with the information for you to see what I mean.
Many thanks,
Matt
Bookmarks