Results 1 to 8 of 8

Thread: Automating My Excel Project

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Automating My Excel Project

    Hi,

    I am automating a course schedule. I want to test the above cell. If its value is "n" then to hide the cells below. I am extremely new to VBA and macros. Could someone please tell me what I am doing wrong?

    Sub HideRows_Based_On_Values()
    If Range("C2").Value = "n" Then
        For Each cell In Range("c3:c20")
            If cell.Value = "n" Then cell.EntireRow.Hidden = True
    End If
    Next cell
    End Sub
    Last edited by Aussiebear; 02-15-2023 at 02:32 PM. Reason: Added code tags to submitted code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •