+ Reply to Thread
Results 1 to 4 of 4

VB code help

  1. #1
    Gordon Byrne
    Guest

    VB code help

    Hi, I need help writing a simple code that will take a number between 1-4,
    out of a single colum in a specific worksheet and identify it with a word.
    ie. 1=Breakfast, 2=Lunch, 3=Supper and 4=Night.

    Here is a little back ground, I wrote a program in my TI calc that stores
    1-4 to represent the meal time. I now have taken that Matrix from my calc
    and opened it as a worksheet to make a graph out of it. on my graph I want
    the words "Breakfast", "Lunch", ect. spelled out at the corresponding spot.

    Ive done VB code before but I have kind of forgotten most of it

    Thanks for any help. I have cross referenced this in both programing, and
    misc excel groups.

    Gordy



  2. #2
    R.VENKATARAMAN
    Guest

    Re: VB code help

    you need not use vba .you can use spreadsheet formula

    your data is from A1 down

    try this formula in cell in B1
    =IF(A1=1,"breakfast",IF(A1=2,"lunch",IF(A1=3,"supper",IF(A1=4,"night"))))
    now copy this formula B1 down.

    chang according to your database

    if you can use vba use "select"


    Gordon Byrne <[email protected]> wrote in message
    news:rvPqe.3761$%[email protected]...
    > Hi, I need help writing a simple code that will take a number between 1-4,
    > out of a single colum in a specific worksheet and identify it with a word.
    > ie. 1=Breakfast, 2=Lunch, 3=Supper and 4=Night.
    >
    > Here is a little back ground, I wrote a program in my TI calc that stores
    > 1-4 to represent the meal time. I now have taken that Matrix from my calc
    > and opened it as a worksheet to make a graph out of it. on my graph I

    want
    > the words "Breakfast", "Lunch", ect. spelled out at the corresponding

    spot.
    >
    > Ive done VB code before but I have kind of forgotten most of it
    >
    > Thanks for any help. I have cross referenced this in both programing, and
    > misc excel groups.
    >
    > Gordy
    >
    >






  3. #3
    Andy Wiggins
    Guest

    Re: VB code help

    =CHOOSE(A1,"breakfast","lunch","supper","night")

    --
    Andy Wiggins FCCA
    www.BygSoftware.com
    Excel, Access and VBA Consultancy
    -

    "Gordon Byrne" <[email protected]> wrote in message
    news:rvPqe.3761$%[email protected]...
    > Hi, I need help writing a simple code that will take a number between 1-4,
    > out of a single colum in a specific worksheet and identify it with a word.
    > ie. 1=Breakfast, 2=Lunch, 3=Supper and 4=Night.
    >
    > Here is a little back ground, I wrote a program in my TI calc that stores
    > 1-4 to represent the meal time. I now have taken that Matrix from my calc
    > and opened it as a worksheet to make a graph out of it. on my graph I

    want
    > the words "Breakfast", "Lunch", ect. spelled out at the corresponding

    spot.
    >
    > Ive done VB code before but I have kind of forgotten most of it
    >
    > Thanks for any help. I have cross referenced this in both programing, and
    > misc excel groups.
    >
    > Gordy
    >
    >




  4. #4
    Don Guillett
    Guest

    Re: VB code help

    One way using code
    Sub selectmeal()
    Select Case Range("L1")
    Case 1: x = "b"
    Case 2: x = "l"
    Case 3: x = "d"
    Case 4: x = "n"
    Case Else
    End Select
    Range("l1").Offset(0, 1) = x
    End Sub

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Gordon Byrne" <[email protected]> wrote in message
    news:rvPqe.3761$%[email protected]...
    > Hi, I need help writing a simple code that will take a number between 1-4,
    > out of a single colum in a specific worksheet and identify it with a word.
    > ie. 1=Breakfast, 2=Lunch, 3=Supper and 4=Night.
    >
    > Here is a little back ground, I wrote a program in my TI calc that stores
    > 1-4 to represent the meal time. I now have taken that Matrix from my calc
    > and opened it as a worksheet to make a graph out of it. on my graph I

    want
    > the words "Breakfast", "Lunch", ect. spelled out at the corresponding

    spot.
    >
    > Ive done VB code before but I have kind of forgotten most of it
    >
    > Thanks for any help. I have cross referenced this in both programing, and
    > misc excel groups.
    >
    > Gordy
    >
    >




+ 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