Deleting every other row

SeattleJim

New Member
Joined
Jun 4, 2007
Messages
20
This has either been asked before or is too simple to where I can't figure it out. I have a column of numbers that are duplicated... so I basically want to delete every other row. Any way of doing it without using dba? Or is that my only way? Thanks.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,166
Try this its from a post i was asked about yesterday:

Code:
Sub PullEveryNthRow() 

' Pull every Nth row from the selected range and place those values in 
' a new worksheet. 

   Dim Increment As Long 
   Dim Source As Range 
   Dim TargetSheet As Worksheet 
   Dim SourceRow As Long 
   Dim TargetRow As Long 
    
   ' Use the current selection for the source 
   Set Source = Selection 
    
   ' Query user for the increment 
   Do 
      Increment = InputBox("Enter increment:") 
      If Increment < 1 Then 
         Exit Sub 
      End If 
   Loop Until Increment > 0 

   ' Add a new sheet and move the data 
   Sheets.Add 
   Set TargetSheet = ActiveSheet 
   TargetRow = 1 
   For SourceRow = 1 To Source.Rows.Count Step Increment 
      TargetSheet.Rows(TargetRow). _ 
         Resize(1, Source.Columns.Count).Value _ 
         = Source.Rows(SourceRow).Value 
      TargetRow = TargetRow + 1 
   Next SourceRow 

End Sub

Highlight your column of data....Enter 2 in the pop up box which appears, the macro will cut every 2nd row and paste to a new sheet then use this data.

Hope this helps
 

Watch MrExcel Video

Forum statistics

Threads
1,129,816
Messages
5,638,496
Members
417,029
Latest member
lingx86

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top