+ Reply to Thread
Results 1 to 3 of 3

Offset Inputbox function - change cell colour

  1. #1
    Registered User
    Join Date
    06-01-2004
    Posts
    36

    Offset Inputbox function - change cell colour

    Hey folks,

    I believe I got an easy one here. I am getting the user to enter two values via Inputbox function. First value is U, D, L, or R and second input is 1, 2, 3 or 4. Based on user input, I want to color the corresponding cell from D8 based on input. For example, if they hit U for Up and 3, I want to color cell D5 with yellow. If they hit R for Right and 4, I want to color cell A8 with Red. I am running this in VBA and I am thinking offset but any suggestions would be great.

    Thank you
    Last edited by pike; 03-25-2011 at 08:49 PM. Reason: In proper Title

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Offset Inputbox function - change cell colour

    what is the column in which U,D,L.R is entered and in which column 1,2,3,4 are entered.
    I presume the corresponding cell in column D is to be colored.l

    let us assume U,D,L,R is entgered in column E form row 5 down and 1,2,3,4 entered in column F

    select D5
    use conditional formatting
    the formla is
    =and(E5="U",F5=3)
    and click format and choose pattern and choose the color
    click add and introduce the second formula etc

    but in excel 2003 or earlier only three conditions can be given. I supposein excel 2007 more conditions can be given


    formats in D5 canbe copied down as pastesecial-formats.
    think on these lines

  3. #3
    Registered User
    Join Date
    06-01-2004
    Posts
    36

    Re: Offset Inputbox function - change cell colour

    Thanks for your input. I am planning on receiving the user input via VBA. I will assign a variable as such,

    direct = UCase(InputBox("Enter Direction", "Input Direction"))
    integ = InputBox("Enter Number", "Input Number")

    From here, D8 being my starting point, based on what the user enters I want to go Up, Down, Left or Right. And from the number the user enters, that is cell I want to colour. Considering D8 is the starting point,I would use the Offset function.

    Thanks again.

+ 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