2

I have a big csv file opened in EXCEL. I would like to delete all the rows from row 100020 to row 800030. I tried selecting all the rows using mouse, but not quite easy. Are there any easy approaches to do this kind of deleting operation?

user288609
  • 12,465
  • 26
  • 85
  • 127
  • highlight row 100020. scroll down using mouse wheel/scroll bar (not cursor keys - the highlighting should not vanish) to row 800030, and then SHIFT+click to highlight this row and all rows in between – SeanC Nov 12 '13 at 21:17

3 Answers3

4

You mean like this:

Sub deleteRows()
  Rows("100020:800030").Delete Shift:=xlUp
End Sub

Place the code in new module file like this:

enter image description here

Automate This
  • 30,726
  • 11
  • 60
  • 82
3

Hit Ctrl+G (Go To), In "Reference" box enter $100020:$800030 and hit enter. This selects the rows. Then do what you need with them: delete, copy, etc.

nsg
  • 539
  • 1
  • 6
  • 18
-1

If you have a raw text csv that you imported into Excel, this'll work faster with sed (if you have access to a system with sed):

sed '100020,800030d' my.csv > my_new.csv 
cbmanica
  • 3,502
  • 7
  • 36
  • 54