Removing Selected weeks from a list

waxb18

Board Regular
Joined
May 31, 2011
Messages
179
Hi Again guys

I need another little macro help.
I need to write a macro that will remove any data pre week 28, 2009.

My data is organised as such but does not consist of 2 columns but 29.



<TABLE style="WIDTH: 150pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=200><COLGROUP><COL style="WIDTH: 75pt; mso-width-source: userset; mso-width-alt: 3657" span=2 width=100><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 75pt; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17 width=100><NOBR>Week</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 width=100><NOBR>Year</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>28</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2008</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>45</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2008</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>52</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2008</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>12</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2009</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>28</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2009</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>38</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2009</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>44</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2009</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>52</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2009</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>37</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2010</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>39</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2010</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR>42</NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR>2010</NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR></NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR></NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR></NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR></NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR></NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR></NOBR></TD></TR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><NOBR></NOBR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63 height=17><NOBR></NOBR></TD><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl63><NOBR></NOBR></TD></TR></TBODY></TABLE>
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try

Code:
Sub atest()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
    If Range("B" & i).Value < 2009 Or (Range("A" & i).Value < 28 And Range("B" & i).Value = 2009) Then Rows(i).Delete
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

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