VBA Syntax problem

  • Follow


I am trying to set up a macro which would only run if there is a value in 
any of the three cells to the left of active cell.  The following does not 
seem to work and would appreciate any help in correcting this:

If ActiveCell.FormulaR1C1 = "(SUM(RC[-3]:RC[-1])<>0" Then
    run macro code
End If

JP 

0
Reply JP 3/9/2010 9:47:23 AM

Try

    If Application.Counta(Activecell.Offset(0, -3).Resize(, 3)) > 0 Then

        run macro code
    End If

-- 

HTH

Bob

"JP" <Doug@nomail.com> wrote in message 
news:D19033E5-F23A-4C11-B87E-398F2A737D6B@microsoft.com...
>I am trying to set up a macro which would only run if there is a value in
> any of the three cells to the left of active cell.  The following does not
> seem to work and would appreciate any help in correcting this:
>
> If ActiveCell.FormulaR1C1 = "(SUM(RC[-3]:RC[-1])<>0" Then
>    run macro code
> End If
>
> JP
> 


0
Reply Bob 3/9/2010 11:46:02 AM


1 Replies
180 Views

(page loaded in 0.203 seconds)


Reply: