Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Delete rows with data

Hello,

I have seen several variations on this, but can't get them to work on my
spreadsheet. I have several rows of data(around 600, but it will change each
time). How can I delete all rows that contain any data in column J? When I
did the recording macro, it did this:

Selection.AutoFilter Field: =10, Criteria1:="<"
ActiveWindow.SmallScroll Down:=-12
Selection.EntireRow.Delete

This works for my original data, but when I tested it on prior data, it
didn't work.

My VBA knowledge is very basic, if you can't already tell. :-)
Any help will be appreciated.

Thanks!
Amy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Delete rows with data

One way:-

Sub mission()
With ActiveSheet
lastrow = .Cells(.Rows.Count, "J").End(xlUp).Row
End With
For x = lastrow To 1 Step -1
Cells(x, 10).Select
If ActiveCell.Value < "" Then
Selection.EntireRow.Delete
End If
Next
End Sub


Mike

"AmyLynn9156" wrote:

Hello,

I have seen several variations on this, but can't get them to work on my
spreadsheet. I have several rows of data(around 600, but it will change each
time). How can I delete all rows that contain any data in column J? When I
did the recording macro, it did this:

Selection.AutoFilter Field: =10, Criteria1:="<"
ActiveWindow.SmallScroll Down:=-12
Selection.EntireRow.Delete

This works for my original data, but when I tested it on prior data, it
didn't work.

My VBA knowledge is very basic, if you can't already tell. :-)
Any help will be appreciated.

Thanks!
Amy

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Delete rows with data

Thanks! That worked. Is there any way to make this move faster? It took a
good 5 minutes for this to delete all of the rows.

"Mike H" wrote:

One way:-

Sub mission()
With ActiveSheet
lastrow = .Cells(.Rows.Count, "J").End(xlUp).Row
End With
For x = lastrow To 1 Step -1
Cells(x, 10).Select
If ActiveCell.Value < "" Then
Selection.EntireRow.Delete
End If
Next
End Sub


Mike

"AmyLynn9156" wrote:

Hello,

I have seen several variations on this, but can't get them to work on my
spreadsheet. I have several rows of data(around 600, but it will change each
time). How can I delete all rows that contain any data in column J? When I
did the recording macro, it did this:

Selection.AutoFilter Field: =10, Criteria1:="<"
ActiveWindow.SmallScroll Down:=-12
Selection.EntireRow.Delete

This works for my original data, but when I tested it on prior data, it
didn't work.

My VBA knowledge is very basic, if you can't already tell. :-)
Any help will be appreciated.

Thanks!
Amy

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete rows with data

Check out this page for a few ways
http://www.rondebruin.nl/delete.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"AmyLynn9156" wrote in message ...
Thanks! That worked. Is there any way to make this move faster? It took a
good 5 minutes for this to delete all of the rows.

"Mike H" wrote:

One way:-

Sub mission()
With ActiveSheet
lastrow = .Cells(.Rows.Count, "J").End(xlUp).Row
End With
For x = lastrow To 1 Step -1
Cells(x, 10).Select
If ActiveCell.Value < "" Then
Selection.EntireRow.Delete
End If
Next
End Sub


Mike

"AmyLynn9156" wrote:

Hello,

I have seen several variations on this, but can't get them to work on my
spreadsheet. I have several rows of data(around 600, but it will change each
time). How can I delete all rows that contain any data in column J? When I
did the recording macro, it did this:

Selection.AutoFilter Field: =10, Criteria1:="<"
ActiveWindow.SmallScroll Down:=-12
Selection.EntireRow.Delete

This works for my original data, but when I tested it on prior data, it
didn't work.

My VBA knowledge is very basic, if you can't already tell. :-)
Any help will be appreciated.

Thanks!
Amy

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete rows data moving njoseph Excel Discussion (Misc queries) 3 June 1st 10 11:07 PM
Delete specific rows of data Roger Bell New Users to Excel 3 June 19th 07 08:40 AM
Delete rows with no data Mindie Setting up and Configuration of Excel 1 November 30th 05 09:24 PM
Delete selected rows data Pat Excel Programming 1 January 24th 05 04:02 PM
Delete certain rows of data... RMJ Excel Programming 3 January 26th 04 08:30 AM


All times are GMT +1. The time now is 04:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"