help writing a macro please!

  • Thread starter Thread starter mcarter
  • Start date Start date
M

mcarter

I need help writing a macro.
I have a worksheet of columns A - D, with 100 rows.
I need to hide the row if the value in column C is 0.
I can get the macro started in row 1 of column C by recording
a macro and selecting that cell, but from there I don't know
what to do. Thanks soooooo much!
 
hi
Sub mcarter()
Dim r As Range
Dim rd As Range
Set r = Range("c1")
Do While Not IsEmpty(r)
Set rd = r.Offset(1, 0)
If r.Value = 0 Then
r.EntireRow.Hidden = True
End If
Set r = rd
Loop
MsgBox "done"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top