+ Reply to Thread
Results 1 to 7 of 7

IF statement to control formatting?

  1. #1
    Registered User
    Join Date
    07-07-2006
    MS-Off Ver
    Excel 2007
    Posts
    60

    IF statement to control formatting?

    Hi, does anyone know if there is any way to use an IF statement to change formatting on a cell? I do not want to use conditional formatting because there are a lot more than 3 possibilities with what I am working with.

    For example...I want to basically do this:

    -----A-----B-----C--
    1---- ----- ------ --
    2---- ----- ------ --
    3---- -----5-----7--


    In A1 I would like to put something like.. =IF(A3=="",set A1 to blank and do not copy formatting,otherwise set A1 to A3 and DO copy formatting) and be able to drag this across the whole Row 1.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Post a sample file with an example

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    07-07-2006
    MS-Off Ver
    Excel 2007
    Posts
    60
    not sure how to post xls file on here soo..

    http://www.mediafire.com/?1pdxc1ybtgn


    oh wait i got it haha
    Attached Files Attached Files
    Last edited by drdavidge; 01-24-2008 at 03:18 PM.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try click the sheet tab > select view code > paste in the below

    Please Login or Register  to view this content.
    VBA Noob

  5. #5
    Registered User
    Join Date
    07-07-2006
    MS-Off Ver
    Excel 2007
    Posts
    60
    Wow.. that is awesome. I didnt even know you can put code on sheets.

    Now.. I have about 20 ranges where I want this to work.. can I just ammend this line to include them all like so..?

    Please Login or Register  to view this content.
    etc?
    Last edited by VBA Noob; 01-24-2008 at 05:10 PM.

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Please remember to wrap your code next time as per forum rules below

    Try

    Please Login or Register  to view this content.
    VBA Noob

  7. #7
    Registered User
    Join Date
    07-07-2006
    MS-Off Ver
    Excel 2007
    Posts
    60
    Great.. thank you very much - this is going to save me a ton of time.

+ 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