A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

delete multiple rows



 
 
Thread Tools Display Modes
  #1  
Old June 15th, 2004, 01:54 AM
Continental Translations
external usenet poster
 
Posts: n/a
Default delete multiple rows

I want to delete rows 4,6,8,10,12 etc etc.... So, from row 4, I want to
delete every other row. My rows go up to 4000 or so

Any ideas?




  #2  
Old June 15th, 2004, 02:15 AM
Continental Translations
external usenet poster
 
Posts: n/a
Default delete multiple rows

Managed to do it with a Macro

Thanks anyway

Continental Translations wrote in message
...
I want to delete rows 4,6,8,10,12 etc etc.... So, from row 4, I want to
delete every other row. My rows go up to 4000 or so

Any ideas?






  #3  
Old June 15th, 2004, 04:14 AM
Gord Dibben
external usenet poster
 
Posts: n/a
Default delete multiple rows

Sub Delete_OddorEvenRows()
Dim rngStart As Range
Dim rngDel As Range
Dim rngTemp As Range
Dim rowCount As Long
oddeven = InputBox("Enter 1 To Delete Odd Rows or 2 To Delete Even Rows")
If oddeven = "" Then Exit Sub
Application.ScreenUpdating = False
If oddeven = 2 Then
Range("a1").Select
With Selection
.EntireRow.Insert
End With
GoTo keepon
Else
keepon:
Set rngStart = Range("1:1")
Set rngTemp = rngStart
For rowCount = 1 To ActiveSheet.UsedRange.Rows.Count
If rowCount Mod 2 = 0 Then
Set rngDel = rngStart.Offset(rowCount, 0)
Set rngTemp = Union(rngTemp, rngDel)
End If
Next
rngTemp.Select
Selection.EntireRow.Delete
End If
Application.ScreenUpdating = True
Range("A1").Select
End Sub

Gord Dibben Excel MVP

On Tue, 15 Jun 2004 00:54:51 +0000 (UTC), "Continental Translations"
wrote:

I want to delete rows 4,6,8,10,12 etc etc.... So, from row 4, I want to
delete every other row. My rows go up to 4000 or so

Any ideas?




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:22 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.