About Miguel Zapico Expertise I can answer question about how to use scripts to consolidate data, connect different systems and automate tasks. I have no experience on using VBScript on web programming.
Experience I have been using VBScript and Windows Scripting Host as my swiss tool for the last 6 years.
Organizations New York PC users group (NYPC)
Independant Computer Consultants Association (ICCA)
Education/Credentials Microsoft MCSE in Windows NT
Expert: Miguel Zapico Date: 6/19/2006 Subject: select the last 3 rows in excel
Question I need to know how to select the last three rows in an excel workbook so they can be deleted in a macro. The problem I have is that the last 3 rows will not always be on the same row number?
Any Ideas? Thanks
Answer You may use the currentrange property, with a code like this:
sub Delete3Rows()
Dim myRange As Range
Dim i
Set myRange = Worksheets("Sheet1").Range("A1").CurrentRegion
i = myRange.Rows.Count
Rows(i - 2 & ":" & i).Delete
End sub
This code selects all the region with data around A1 on Sheet1, and deletes the 3 last rows. To make it work in the worksheet you need, change the worksheet("Sheet1") part.