+ Reply to Thread
Results 1 to 3 of 3

Conditional formatting in VBA

  1. #1
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Conditional formatting in VBA

    Hi,

    Must admit the R1C1 still confuses me, but somehow I have this working. Currently the RC4 displays in conditional format as $D8 and the RC4 as $C8, but I'm confused at how it knows to start at R8? Is there any way to make the formulas read ="=$D8=""No""" instead?

    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 11-25-2009 at 03:38 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Conditional formatting in VBA

    R1C1 is I think quite straightforward once you get the hang of the basic premise that the referencing is relative to where the formula etc is being placed...

    eg if cell were say A10 then

    RC is A10

    R[1]C is A11

    R[1]C[1] is B11

    R20C is A$20

    R20C2 is $B$20
    so ...

    -- anything appearing post R/C in [ ] is a relative adjustment
    (where negative for R equates to upwards and for C equates to left)

    -- anything appearing post R/C outside of brackets is an absolute reference

    -- if R/C is not followed by a number it adopts relative position

    For column references (as opposed to individual cells) then again using A10 as the "base"

    C is A:A

    C1 is $A:$A

    C[3] is D:D
    and for row references

    R is 10:10

    R1 is $11:$11

    R[3] is 13:13
    I hope that helps.

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Post Re: Conditional formatting in VBA

    That does help a lot Luke. I think you are right, once you can come to grips with understanding how R1C1 works it is pretty straightforward. For my problem I finally came up with =AND(LEN(RC[-1])>0,ISBLANK(RC)) which in normal referencing is =AND(LEN(C8)>0,ISBLANK(D8)). I finally realized with starting in D8 I then adjust from that starting point. This seems to work as I paste the format through column G. Again, thanks for the push in the right direction.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1