ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting a Pattern of Rows (https://www.excelbanter.com/excel-programming/364143-selecting-pattern-rows.html)

bodhisatvaofboogie

Selecting a Pattern of Rows
 
Okay, I want to select rows 1,2.....47, 48.......93,94......etc etc on to
infinity. It is that pattern, so every 45th and 46th row, then have the
entire row deleted. How might I go about doing this??? Don't ask me why,
it's just one part of what I want my macro to do. I am at a loss for how to
write a formula up for this. THANKS!!!

Die_Another_Day

Selecting a Pattern of Rows
 
Does this work?

i = 65505
do
Rows(i).delete shift:=xlUp
Rows(i).delete shift:=xlUp
i = i - 46
while i 0

Die_Another_Day
bodhisatvaofboogie wrote:
Okay, I want to select rows 1,2.....47, 48.......93,94......etc etc on to
infinity. It is that pattern, so every 45th and 46th row, then have the
entire row deleted. How might I go about doing this??? Don't ask me why,
it's just one part of what I want my macro to do. I am at a loss for how to
write a formula up for this. THANKS!!!



Tom Ogilvy

Selecting a Pattern of Rows
 
Sub AAA()
Set rng = Cells(1, 1).Resize(2, 1)
For i = 45 To 500 Step 45
Set rng = Union(rng, Cells(i, 1).Resize(2, 1))
Next
rng.EntireRow.Select
End Sub

if that selects the rows you want, then change Select to Delete and run it
again.

Change 500 to any number up to 65536

--
Regards,
Tom Ogilvy




"bodhisatvaofboogie" wrote:

Okay, I want to select rows 1,2.....47, 48.......93,94......etc etc on to
infinity. It is that pattern, so every 45th and 46th row, then have the
entire row deleted. How might I go about doing this??? Don't ask me why,
it's just one part of what I want my macro to do. I am at a loss for how to
write a formula up for this. THANKS!!!


Die_Another_Day

Selecting a Pattern of Rows
 
Does this work?

i = 65505
do
Rows(i).delete shift:=xlUp
Rows(i).delete shift:=xlUp
i = i - 46
while i 0

Die_Another_Day
bodhisatvaofboogie wrote:
Okay, I want to select rows 1,2.....47, 48.......93,94......etc etc on to
infinity. It is that pattern, so every 45th and 46th row, then have the
entire row deleted. How might I go about doing this??? Don't ask me why,
it's just one part of what I want my macro to do. I am at a loss for how to
write a formula up for this. THANKS!!!




All times are GMT +1. The time now is 01:45 AM.

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