Do While Loop error - Where am I going wrong?

Woody75

Board Regular
Joined
Feb 26, 2012
Messages
114
Hi All,

I'm a complete beginner to all this so please be gentle...

when i try to run this code it tells me that there's a compile error - Loop without Do. Where am i going wrong?

Sub Button6_Click()
Dim Counter As Integer
Counter = 2

Do While ThisWorkbook.Sheets("Obs Sheet").Cells(Counter, 15).Value <> ""
ThisWorkbook.Sheets("Annex B").Range("J8:X8").Value = ThisWorkbook.Sheets("Obs Sheet").Range("O" & Counter).Value

If ThisWorkbook.Sheets("Annex B").Range("AT5").Value = "Y" Then
ThisWorkbook.Sheets("Annex B").Range("AS3:AS103").AutoFilter Field:=1, Criteria1:="Y"
MsgBox "Printed press OK to continue!"
Else
ThisWorkbook.Sheets("Annex B").Range("AS3:AS103").AutoFilter Field:=1
MsgBox "Did Not Print, press OK to continue!"

Counter = Counter + 1

Loop

End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,207,436
Messages
6,078,539
Members
446,345
Latest member
MicCh

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