ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection of Rows (https://www.excelbanter.com/excel-programming/302890-selection-rows.html)

Alan

Selection of Rows
 
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.



Bernie Deitrick

Selection of Rows
 
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

"Alan" wrote in message
...
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

Selection of Rows
 
Bernie,
That's wonderful, absolutely perfect,
Thank You So Much!!
Alan.
"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
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

"Alan" wrote in message
...
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.








All times are GMT +1. The time now is 02:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com