View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Jarek Kujawa[_2_] Jarek Kujawa[_2_] is offline
external usenet poster
 
Posts: 896
Default Next without For..?

insert "End If" instead of "Else"

On 29 Kwi, 12:28, merry_fay
wrote:
Hi,

I've written this bit of basic code to hide some rows for me:

Sub hiddenrow()

* * Range("A1").Select

* * For i = 1 To 516
* * ActiveCell.Offset(1, 0).Select
* * If ActiveCell.Value = "hiddenrow" Then
* * Selection.EntireRow.Hidden = True
* * Else

* * Next i

End Sub

but when I try to run it it, it comes up with the Compile Error 'Next
without For'
I've used For & I can't see what I've done wrong! Can anyone help please?

Thanks
merry_fay