+ Reply to Thread
Results 1 to 4 of 4

my if-then-else script is not working

  1. #1
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    my if-then-else script is not working

    I am trying to use font color in an if-then-else script. The problem I have is that the if-then-else script ignores the color definition.
    With the below script I always get 2 even if the font color is -65536. What is wrong in this script?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: my if-then-else script is not working

    Try this

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: my if-then-else script is not working

    no that doesn't work. But close. The color code was the problem! In my case the color code is 5.
    But I don't understand why it is 5 and not -65536. If I use the macro recorder to check the color code I get -65536.
    I discovered that it is 5 because long time ago I did this before and I remembered where I did it.

    How can I determine the correct color code of a cells font color?

  4. #4
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: my if-then-else script is not working

    I found a way:

    Sheets("HUG").Cells(1, 2) = Sheets("HUG").Cells(1, 1).Font.ColorIndex

+ 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