|
-
Jul 16th, 2009, 11:25 AM
#1
Thread Starter
Member
[RESOLVED] VB Deleting Filtered Rows (Except First)
I have a spreadsheet with Columns A-CP and an abundance of Rows. It is a list of Customers and their Phone Numbers and other data that regards to them.
I have a Macro that runs on this Workbook which will accomplish many things but one thing I am having trouble is trying to delete something that I have filtered.
I am now working on Deleting the Outright from my Everything Tab. When I first ran the Macro the process looks like this:
Code:
Sub OutrightDelete()
' Deletes Outrights from Everything
Rows("129:129").RowHeight = 16.5
Rows("129:2387").Select
Selection.Delete Shift:=xlUp
End Sub
My goal is to be able to import another Spreadsheet into this Workbook and do the same thing. In that respect, if I was to run this macro it would not work since other Spreadsheets do not have a Range of Rows from 129:2837 after being filtered.
So what I need to do is make a Macro that finds the first row once Filtered (129) (obviously excluding Row 1 with my headers in it) and the Last Row (2387), Select them and all in between, and Delete them. So far I have this:
Code:
Sub OutrightDelete()
' Deletes Outrights from Everything
Sheets("Everything").Select
Dim FirstRow As Long
FirstRow = Range("A65536").End(xlUp).Row - 1
Dim LastRow As Long
LastRow = [A65536].End(xlDown).Row
Range(Cells(FirstRow, 1), Cells(LastRow, 1)).Select
Selection.Delete Shift:=xlUp
End Sub
When it runs it i will delete the last row. How would I loop this to make it delete all the rows except for the first one (which is my Header Column)?
If you notice that I don't need something its because it was all mainly copy/paste from other similar parts. I am still learning how to write this 100%.
Thanks in advance.
Edit: I fixed it myself. Hurray!
Last edited by DarkBox121; Jul 21st, 2009 at 01:46 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|