Selection of Rows

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

Hi,
I import a fairly large amount of data into Excel (2500 rows or so) each
day from an ancient system, I'm not even really sure what the system is.
I've got the hang of Data to Columns, TRIM, etc to convert the data into a
form that can be manipulated in Excel.
What I need to do is to select the entire rows 2:3,5:6,8:9 and so on as they
usually (but not always) contain superfluous data so I can check the
contents before deleting them. That is to say, Don't select row one but do
select rows two and three, Don't select row four but do select rows five and
six and so on down a range of around 3000 rows.
I've tried without success to write a macro to do this as the large range
makes manual selection very tedious. Can anyone please offer me any advice?
All help gratefully received!
Thanks,
Alan.
 
Alan,

Sub AlanSelect()
Dim i As Long
Dim RowCount As Long
Dim mySelect As Range

RowCount = Range("A1").SpecialCells(xlCellTypeLastCell).Row

Set mySelect = Range("2:3")

For i = 5 To RowCount Step 3
Set mySelect = Union(mySelect, Range(i & ":" & i + 1))
Next i

mySelect.Select
End Sub

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top