Consulting

Results 1 to 5 of 5

Thread: Conditional format an indentation based upon a formula from separate cell

  1. #1

    Smile Conditional format an indentation based upon a formula from separate cell

    To whom it may concern,

    I am trying to include a conditional format to indent a particular cell if another cell (month number) = 1, 6, 9 or 12.

    Can anyone share some VB code that would help? Is this even possible?

    Thanks very much.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can you elaborate upon what exactly you mean by indent a cell.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,063
    Location
    Right text format perhaps?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  4. #4
    Thanks for replying.

    I have a large report with a Table of Contents (TOC) on a particular worksheet.

    I then have an IF statement that pulls in the categories into the TOC depending on what month it is. The month is a named range (single cell) on another worksheet. The named range = MonthNumber and equals 1-12. Month 1 pulls in different categories than Months 6, 9, 12 which is different than the other months.

    There is a column of cells (d8:d29) on the TOC where, depending on the month, I would like to either:
    a. increase indent 1 from the left one or more of these cells or
    b. left justify one or more of these cells.

    Ultimately, I was thinking about writing a formula using the conditional format like:

    Default setting: all cells are left justified
    1. IF month=x, increase indent by 1 or

    Default setting: all cells start from the left and are indented 1,
    2. IF month=x, left justify

    Please let me know if you have any other questions. Thank you for your help.

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Okay,

    start by selecting all the cells in D8:D29
    left-justify the cells
    setup CF with a formula of =MONTH(D8)=MonthNumber
    click Format
    select the Number tab
    select Custom type
    use a format of _wdd-mmm (or _wdd/mm/yyy, or whatever date format you want)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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