VB code help #2

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 


0
gordyjb (13)
6/12/2005 5:12:55 AM
excel.misc 78881 articles. 5 followers. Follow

3 Replies
665 Views

Similar Articles

[PageSpeed] 7

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 <gordyjb@yahoo.com> wrote in message
news:rvPqe.3761$%j7.1889@newssvr11.news.prodigy.com...
> 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
>
>




0
R
6/12/2005 5:26:33 AM
=CHOOSE(A1,"breakfast","lunch","supper","night")

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

"Gordon Byrne" <gordyjb@yahoo.com> wrote in message
news:rvPqe.3761$%j7.1889@newssvr11.news.prodigy.com...
> 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
>
>


0
ng20050514 (63)
6/12/2005 7:02:07 AM
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
donaldb@281.com
"Gordon Byrne" <gordyjb@yahoo.com> wrote in message
news:rvPqe.3761$%j7.1889@newssvr11.news.prodigy.com...
> 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
>
>


0
Don
6/12/2005 12:27:32 PM
Reply:

Similar Artilces:

Sharing a Workbook #2
I'm hoping someone can help me with this. I designed a finance matri for the company I work for so that the phone reps are able to decid whether or not an applicant qualifies for a credit card. The spreadsheet has a bunch of macros, drop down lists, and such. I is important that I track every 'set' of information that is keyed in. Right now, I have a button called "Submit" and it takes the info tha was keyed in, and stores it in another 'hidden' sheet in the workbook. I have 20 copies of the workbook, one for each employee. The proble arises when I need to make...

Drag and drop on a recycle bin ... a little help needed
Hello all I have implemented the drag and drop code from The Code project http://www.codeproject.com/shell/explorerdragdrop.asp?msg=420048 but it crashes when the files are dropped on the recycle bin. CCmdTarget::~CCmdTarget() { #ifndef _AFX_NO_OLE_SUPPORT if (m_xDispatch.m_vtbl != 0) ((COleDispatchImpl*)&m_xDispatch)->Disconnect(); ASSERT(m_dwRef <= 1); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE #endif #ifdef _AFXDLL m_pModuleState = NULL; #endif } Does anyone have an...

Trendline values #2
I used the function "LOGEST" to get an exponential fit of a series of numbers, which gives me a value of 1.0610. I also used "RSQ" function to get the R-square, which is 0.9442. Then I made a chart based on the same series of numbers and add trendline to the curve. I selected "Exponential" under "Type" and checked "Display equation on chart" and "Display R-Squared value on chart". The value shown on the chart is "y=3928.8e^0.0592x" and "R^2=0.9104". I expected to see "y=3928.8e^0.0610x" and "R^...

Outlook 2003 email #2
i am new to the outlook software; currently beginning to use outlook 2003. i am receiving duplicate emails in my in-box; including all the emails i imported from my web based email, yahoo. how do i fix this problem? many thanks for any and every ones helpful guidance. happy new year, technot -- "the world will not solve it''s current problems with like-minded thinking." -Albert Einstein Not a techie here but I have had the same problem. I think that your Outlook profile is corrupt. You can create a new one and import the messages again from your backup. To create a ...

Counting occurences of codes in cells
I have a spreadsheet with various codes separated by periods, in a single cell. Like: C T C,R T,C,R R and so forth. It's easy to count the single codes but how do I cound the "C" when it's with another character? There must be a simple way, without writing code, to do this. Is there? Thanks! maybe... =countif(a1:a10,"*" & "c" & "*") or =countif(a1:a10,"*c*") or if x99 contained the letter c. =countif(a1:a10,"*" & x99 & "*") salgud wrote: > > I have a spreadsheet with various codes separa...

MS Money 2003 #2
I am trying to load MS Money on my PC running Win 2000. All I get is a menu bar that is minimized in the bottom of my screen. Nothing else. I have close virus check and zonealarm, but I can't get the software to install. ...

Exchange/Outlook 2003
In an effort to make sure we never reach the 16GB threshold for the SBS 2003 Exchange Info Store, I'm looking to setup a GPO to give everyone consistent AutoArchive settings as well as a common location for the PST file. I have already downloaded the Office Administrative Templates for Outlook 2003, so I already have found the settings I want to modify and have made the changes, I just haven't made them live on the domain yet. My thoughts to date: * create two GPOs, one for the PST location, one for the autoarchive settings themselves * set PST location to local drive, or common netw...

2 year Lifespan?---
I understand that MSMoney has some sort of built in lifespan of 2 years. What stops working after this date? Do I just buy the next version or is there a way round this? It is mainly the stuff related to online working which stops working, ie quote downloads and bank imports. -- Glyn Simpson, Microsoft MVP - Money http://money.mvps.org Check http://support.microsoft.com/default.aspx?scid=fh;EN-GB;mny or http://money.mvps.org/faq for UK tips and fixes for MS Money. To send Microsoft your product wishes see http://money.mvps.org/wishes.aspx I do not respond to any unsolicited email r...

Code stops for one user, like it has a breakpoint
I have a user where the code stops at this line like it has a breakpoint, but it doesn't. There is no issue on my system. myUserName = Environ("USERNAME") When the user presses F5, it continues to run. Has anyone seen this and what do I need it to do to run without stopping? Thanks, Barb Reinhardt Barb The only thing that stikes me about this is the case. I run several files in here that are used by about 50 people every days. Environ("UserName") has never given us a problem (note the use of Proper Case rather than your UPPER). -- ...

XML TreeNode.Parent property when using 2.0 TreeView?
How do I get a TreeNode.Parent property when using the 2.0 TreeView control? When the data source is an XML file there may be redundant names in the tree. For example, when a child node with the value of 'name' is selected I don't have a clue how to get the name of its parent which may be 'person' or 'school.' <%= Clinton Gallagher "clintonG" <csgallagher@REMOVETHISTEXTmetromilwaukee.com> wrote in message news:%23erL6WOXFHA.3532@TK2MSFTNGP10.phx.gbl... > How do I get a TreeNode.Parent property when using the 2.0 TreeView > control? &...

CRM 1.2 unable to add users in OU but domain root OK.
Hello. I am having trouble adding users to CRM 1.2. If I try to add a CRM user from an OU in the domain with deployment manager or the web GUI it fails. If I add a user to CRM from the root of the domain the user is added fine to CRM. In our test environment I was able to add users to CRM that are in OU's in a test domain without any trouble. Any ideas? Thanks!! Mike ...

Problem with code that inspects thread context and dumps stack trace
Hi! Some years ago, I had to debug a Java application that had a deadlock problem. It wasn't so hard, because I've been told about a JVM command (now, I don't even remember how to activate it!) that dumps the status of all threads in an app, including "what they are waiting for" (locks). Now I'm in the "real" world of C++, Win32 applications and MFC (no virtual machines around!). We have many multithreaded applications: what if some bug causes a dedlock, e.g. in a test scenario? We must inspect it, and I'd like to have a tool to simplify my life. Does s...

Error in coding going from one computer to another.
I have a database that works great on my laptop where it was created. I placed it on our server but I am the only one who can access and work with it. Everyone else gets an error for the String. Any suggestions? This is the actual error: Private Sub Combo230_AfterUpdate() ' Find the record that matches the control. Dim rs As Object Set rs = Me.Recordset.Clone rs.FindFirst "[Quality Plan ID] = " & Str(Nz(Me![Combo230], 0)) If Not rs.EOF Then Me.Bookmark = rs.Bookmark End Sub where ther error is at 'Str'. Thank you Dyper How about telling us t...

COUNTIF query #2
Hey all Hopefully a nice easy one.... We have a logging system, and the spreadsheet basically has the person name doing a call, what the call is and how long it took. This is use all day so loads of calls get logged by various people. Say column A is Persons name and Column B is time spent. I need calulation that checks how much time 'person 1', 'person 2', 'person 3 etc has spent on calls during the day and add's it all up. Please can someone show me how to do this, i have tried a COUNTIF bu cant quite get it to work. Many thanks in advance. Darren (digital_life...

cut/copy and paste forumla problem help
i am currently using the correlation formula to test on a large set of data: e.g. CORREL(IGR!C233:C262,IIA!C233:C262) IGR and IIA - they are a pair of data i place in 2 different worksheets, each has set of data, and I need to pull the data of C233 and C262 in IGR and IIA worksheet and I have many pairs in different worksheets E.G. RMR and RHR so I copy the forumla above and hope can only manually adjust the symbol from IGR and IIA to RMR and RHR when I copy it shift the number down =CORREL(IGR!C242:[/B]C271,IIA!C242:C271) from C233 to C242 and C 262 to C271 and I would have to ma...

insert password using vb
I have multi worksheets in a template with formulas. I can hide th formulas but if I add a password, my macros stop and ask for th password when the macro is in a protected worksheet. Is there a way o adding the password to a macro so that the macro will run smoothl without stopping and asking for a manual insertion of the password? Thanks Do -- abbevill ----------------------------------------------------------------------- abbeville's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=976 View this thread: http://www.excelforum.com/showthread.php?threadid=26122 ...

Link Error #2
I was able to use CL.exe to compile and link .cpp or .c file in a command line. But all in a sudden, I can not do this any more, as I always got such an error message: LINK : fatal error LNK1104: cannot open file 'C:\Documents' I didn't do complicated compiling. e.g. I even tested with the "hello word" thing. cl hello.c where hello.c is just this: #include <stdio.h> main() { printf("hello world!\n"); } But again, this LINK : fatal error LNK1104: cannot open file 'C:\Documents' happens too! It seems something wrong with the path that CL....

Restoring and backup of Business Portal 2.5 feature pack
how can i backup and restore my business portal site(2.5 feature pack). The objective is to move it to a different location. I have tried using stsadm.exe tool but it is not successfull. Any help would be greatly appreciated. ...

Please Help strange problem
Hope someone can help with this after downloading a small excel file from a dealer site that is a genereated report, I can download it as an excel file, upon doing so and pasting it into my working sheet I end up with this � with the two dots above it at the end of the text in every cell, and when it is removed some cells change for example a cell which has a long number for a serial number will shorten as well where do I start the excel version is 2000 blacklabhfxnospam@hotmail.com remove no spam ...

help #10
every time i try to send something through outlook I get an error 0x800CCCC0D Do you have any more details about the error? Also, which version of Outlook are you using? "tina" <tinaatweb22@yahoo.com> wrote in message news:081001c365f2$cc7bc3e0$a301280a@phx.gbl... > every time i try to send something through outlook I get > an error 0x800CCCC0D ...

Query related to Help button in Property sheets?
Hi In my application for showing a wizard, i m using Property Sheets(tab dialog boxes derived from CPropertyPage). I have 4 buttons on my wizard: Back, Next, Cancel & Help. My problem is that how do i implement the <Help> button. I have to open a .chm file as soon as the user clicks the <Help> button. But where do i write the code as there is no handler function in the class wizard for Help button. Handler functions for Back,Next & Finish is there? How do i implement the Help button? Waiting for suggestions Regards ...

Installing Money 2007 #2
I have Money 2003 on my computer and I just purchased Money 2007 Deluxe. Do I need to have the latest version and where can I find them so that i can use Money 2007. Everytime I try to install, I get a message telling me that I need the latest version or the Service Pack. Can someone tell me what I need to get this Deluxe installed. Thanks! In microsoft.public.money, JMacon wrote: >I have Money 2003 on my computer and I just purchased Money 2007 Deluxe. Do >I need to have the latest version and where can I find them so that i can use >Money 2007. Everytime I try to inst...

Calendar Appointments #2
I enter a new appointment and nothing shows up on the screen. Anything I add to try to schedule anything doesnt show up.. just a blank calendar. This is Outlook 2003. Anyone have any ideas? ...

Help Sorting Data
I have the following columns of information and need to setup a formula that will give me the total by location, by dept, then by g/l account. DEPT G/L Account Bakersfield Fleet 42101 $10.00 Fleet 42101 $125.00 S & D 42101 $35.00 MEM 42199 $10.00 Fleet 23099 $1,000.00 I will then point to the cell containing the final cost number. Example: Bakersfield, Department Fleet, G/L Account 42101 $1,145 Look at the Subtotal function, or a Pivot Table. Regards, Fred "dh1069"...

How to intercept GP code in Dexterity
I am working through the course material for Dexterity/SanScript and understand that I can "intercept standard GP code" and insert my own procedures. I am a bit unclear on how to "intercept" it. I see that I can use triggers, but how do I know what GP functions or procedures are executing at any given time, so that I know what I'm supposed to intercept, as well as what process(es) I might be interrupting? At this point, I am just learning and do not have a specific task I'm trying to accomplish. I would appreciate all input. Thank you! Mike You can use...