Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Does anyone know how I could write a macro to delete all rows from the first
empty row to row 2000 please? If I use the control+shift+down arrow and then go down one cell, the macro programmes the precise cell reference -- but this changes on datasheets with different amounts of data. HELP PLEASE!!! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this code.
Sub DeleteTo2000() Dim rng As Range Dim wks As Worksheet Set wks = ActiveSheet Set rng = wks.Range("A1").End(xlDown).Offset(1, 0) Range(rng, wks.Range("A2000")).EntireRow.Delete End Sub HTH "Jon M" wrote: Does anyone know how I could write a macro to delete all rows from the first empty row to row 2000 please? If I use the control+shift+down arrow and then go down one cell, the macro programmes the precise cell reference -- but this changes on datasheets with different amounts of data. HELP PLEASE!!! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
set rng = Range("A1").End(xldown)(2)
if rng.row < 2001 then rng.resize(2001-rng.row,1).Entirerow.Delete End If -- Regards, Tom Ogilvy "Jon M" <Jon wrote in message ... Does anyone know how I could write a macro to delete all rows from the first empty row to row 2000 please? If I use the control+shift+down arrow and then go down one cell, the macro programmes the precise cell reference -- but this changes on datasheets with different amounts of data. HELP PLEASE!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hpw do I delete multiple empty rows found between filled rows? | Excel Worksheet Functions | |||
Write a macro that hides rows based on empty cells | Excel Discussion (Misc queries) | |||
How to Delete empty rows in excel in b/w rows with values | Excel Worksheet Functions | |||
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows | Excel Worksheet Functions | |||
Cut and Paste macro based on criteria then delete empty rows | Excel Programming |