#1   Report Post  
Gordon Byrne
 
Posts: n/a
Default 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   Report Post  
R.VENKATARAMAN
 
Posts: n/a
Default

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,"supp er",IF(A1=4,"night"))))
now copy this formula B1 down.

chang according to your database

if you can use vba use "select"


Gordon Byrne wrote in message
m...
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   Report Post  
Andy Wiggins
 
Posts: n/a
Default

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

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

"Gordon Byrne" wrote in message
m...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 7 March 7th 05 06:29 PM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 4th 05 10:50 AM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 3rd 05 03:40 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 0 February 28th 05 06:26 PM


All times are GMT +1. The time now is 07:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"