Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Calling a macro from a conditional function

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'd like to hide rows based on data in the row as in

    =IF(c5<>1,c12/2,HideRow)

    Seems like it shouldn't be too tricky, but just creating a relative macro called "HideRow" doesn't work. Is it a declration thing? Redefining it as publicfunction seems to return "0".

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi
    This seems like it will accomplish what you need.
    I though I had seen syntax to call a procedure from a formula, but I cannot find any info that's even close...
    Try this for now.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$C$5" Then _
    If Range("C5") = 1 Then HideRow
    End Sub
    Tom

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thank you fro your help, but I think I was a bit unclear. I want this to execute per row, so I'd drag-fill that command down the column
    =IF(c5<>1,c12/2,HideRow)
    =IF(c6<>1,c12/2,HideRow)
    Each row being hidden on the c value.
    ...

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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