1st Macro - Loop - Almost There?

northshoreroad

New Member
Joined
Jan 5, 2018
Messages
5
Hi all

Very new to VBA and hoping the community can help

I am trying to return the top 30 results from a number of days throughout the year.

There is only one header, at least 30 rows per day and the data has already been sorted. There will be no blank cells.

[TABLE="width: 262"]
<colgroup><col><col><col span="2"><col></colgroup><tbody>[TR]
[TD]Symbol[/TD]
[TD]Date[/TD]
[TD] Open [/TD]
[TD] Close [/TD]
[TD]Change[/TD]
[/TR]
[TR]
[TD]LEJU[/TD]
[TD]1/3/2017[/TD]
[TD] $ 4.70[/TD]
[TD] $ 4.20[/TD]
[TD]-10.64%[/TD]
[/TR]
[TR]
[TD]TWLO[/TD]
[TD]1/3/2017[/TD]
[TD] $ 29.25[/TD]
[TD] $ 26.50[/TD]
[TD]-9.40%[/TD]
[/TR]
[TR]
[TD]WAAS[/TD]
[TD]1/3/2017[/TD]
[TD] $ 24.15[/TD]
[TD] $ 22.06[/TD]
[TD]-8.65%[/TD]
[/TR]
[TR]
[TD]IO[/TD]
[TD]1/3/2017[/TD]
[TD] $ 6.10[/TD]
[TD] $ 5.60[/TD]
[TD]-8.20%[/TD]
[/TR]
[TR]
[TD]TSQ[/TD]
[TD]1/3/2017[/TD]
[TD] $ 10.46[/TD]
[TD] $ 9.63[/TD]
[TD]-7.93%[/TD]
[/TR]
[TR]
[TD]CNDT[/TD]
[TD]1/3/2017[/TD]
[TD] $ 14.84[/TD]
[TD] $ 13.72[/TD]
[TD]-7.55%[/TD]
[/TR]
[TR]
[TD]FN[/TD]
[TD]1/3/2017[/TD]
[TD] $ 41.05[/TD]
[TD] $ 37.98[/TD]
[TD]-7.48%[/TD]
[/TR]
[TR]
[TD]BCEI[/TD]
[TD]1/3/2017[/TD]
[TD] $ 1.05[/TD]
[TD] $ 0.98[/TD]
[TD]-6.67%[/TD]
[/TR]
[TR]
[TD]SGY[/TD]
[TD]1/3/2017[/TD]
[TD] $ 30.52[/TD]
[TD] $ 28.52[/TD]
[TD]-6.55%[/TD]
[/TR]
</tbody>[/TABLE]

The data above is for 1/3/17 until the end of the year. I would like to keep the first 30 rows, and then delete all rows until the next day (1/4/17 and so on). Once onto the next day keep/skip over the first 30 rows and then delete until the next day

Not sure how to put that into VBA language

From what I've read it would look something like this

Sub Keep_30()
I = 2 < this is where the data starts
I + 30 < skip over 30 rows
Delete until next I
End Sub

Thank you for any help you can provide
 
northshoreroad,

Thanks for the workbook.

The workbook is 8.66 megabytes?????

Your Bad Data worksheet contains 101,730 rows, and, 5 columns of information.

Your Good Data worksheet (results) contains 99,909 rows, and, 5 columns of information.


I am sure that one of the MrExcel MVP's will be able to supply a fast, and, accurate macro to return the results that you are looking for.
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,224,830
Messages
6,181,229
Members
453,026
Latest member
cknader

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
Back
Top