Excel Form and message box

Hi there,

I'm running Excel 2000.  I am just learning so please excuse my questions if 
they sound simple.

To put this as simply as possible I have a spreadsheet of children's names. 
I've created a form that is activated by a control button.  What I want to 
do is choose a child's name from the combo box and eventually delete that 
child from the spreadsheet.  I have an "are you sure" type msgbox but cannot 
get the yes/no side of it functioning correctly.  I've worked on this for 
hours and have just given up.

This is my code so far:

Private Sub cboRemChild_Click()
    Dim myCell As Range
    Dim ChosenName As String
    Dim NameFound As Boolean
    Dim Ans As Integer

    ChosenName = cboChildName.Text
    Sheets("Child Records").Select

    NameFound = False
    For Each myCell In Range("Name_of_Child")
        If myCell.Value = ChosenName Then
            myCell.Select
            NameFound = True
            Unload Me
            Exit For
        End If
    Next myCell

    If NameFound = False Then
        MsgBox "Name not entered or not Found!"
        cboChildName.SetFocus
    End If

    MsgBox "Are you sure you want to remove this child?", vbYesNo

    If Ans = vbYes Then
     Selection.Delete Shift:=xlUp
     Range("A6").Select
    Else
        frmRemChild.Show
    End If
End Sub
-------------------
If either yes or no are chosen it performs the Else command.  What have I 
done wrong?  It would also be great to have the Exclamation Mark icon appear 
in this msgbox.  Oh yes, if you've got this far thank you very much for 
taking the time to read my ramblings :-)

Thanks for any assistance in advance and I'm really sorry if my code looks 
extremely amateur but that's me :-)

Regards
Pam 


0
pam5633 (10)
7/22/2006 2:08:04 AM
excel 39879 articles. 2 followers. Follow

4 Replies
649 Views

Similar Articles

[PageSpeed] 26

Pam Field Wrote:
> Hi there,
> 
> I'm running Excel 2000.  I am just learning so please excuse m
> questions if
> they sound simple.
> 
> To put this as simply as possible I have a spreadsheet of children'
> names.
> I've created a form that is activated by a control button.  What I wan
> to
> do is choose a child's name from the combo box and eventually delet
> that
> child from the spreadsheet.  I have an "are you sure" type msgbox bu
> cannot
> get the yes/no side of it functioning correctly.  I've worked on thi
> for
> hours and have just given up.
> 
> This is my code so far:
> ...
> If NameFound = False Then
> MsgBox "Name not entered or not Found!"
> cboChildName.SetFocus
> End If
> 
> MsgBox "Are you sure you want to remove this child?", vbYesNo
> 
> If Ans = vbYes Then
> Selection.Delete Shift:=xlUp
> Range("A6").Select
> Else
> frmRemChild.Show
> End If
> End Sub
> -------------------
> If either yes or no are chosen it performs the Else command.  What hav
> I
> done wrong?  It would also be great to have the Exclamation Mark ico
> appear
> in this msgbox.  Oh yes, if you've got this far thank you very muc
> for
> taking the time to read my ramblings :-)
> 
> Thanks for any assistance in advance and I'm really sorry if my cod
> looks
> extremely amateur but that's me :-)
> 
> Regards
> Pam

Hi Pam,

Try changing the following line:
MsgBox "Are you sure you want to remove this child?", vbYesNo

to this:
ans = MsgBox "Are you sure you want to remove this child?", vbYesNo

I think that should fix your problems.  (You just need to assign th
return value to your variable in order to be able to use it)

Scot

--
Maistry
-----------------------------------------------------------------------
Maistrye's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3607
View this thread: http://www.excelforum.com/showthread.php?threadid=56393

0
7/22/2006 4:02:01 AM
Thanks Scott,

Unfortunately that give me a 'syntax error' but your response has reminded
me that I don't have an actual ans= statement and I know I must have but
what and where?  I'm getting way to old to learn this stuff!

Any other assistance would be greatly appreciated.

cheers
Pam


>
> Hi Pam,
>
> Try changing the following line:
> MsgBox "Are you sure you want to remove this child?", vbYesNo
>
> to this:
> ans = MsgBox "Are you sure you want to remove this child?", vbYesNo
>
> I think that should fix your problems.  (You just need to assign the
> return value to your variable in order to be able to use it)
>
> Scott
>
>
> -- 
> Maistrye
> ------------------------------------------------------------------------
> Maistrye's Profile:
> http://www.excelforum.com/member.php?action=getinfo&userid=36078
> View this thread: http://www.excelforum.com/showthread.php?threadid=563931
>


0
pam5633 (10)
7/22/2006 4:26:31 AM
Ok I've changed the variable to YesNo (found it on some website) and that 
works now I just have some tidying up to do.  Hope nobody minds if I come 
back with more questions on this one :-)

YesNo = MsgBox("Are you sure you want to remove this child?",

vbYesNo + vbExclamation, "Caution")

    Select Case YesNo
    Case vbYes
         Selection.Delete Shift:=xlUp
         Range("A6").Select
    Case vbNo
        frmRemChild.Show
    End Select
 


0
pam5633 (10)
7/22/2006 5:02:17 AM
Hello,

Try this code

ans = MsgBox ("Are you sure you want to remove this child?", 
vbYesNo+vbExclamation)

"Pam Field" <pam@pamfield.com> wrote in message 
news:44c1a8f9@quokka.wn.com.au...
> Thanks Scott,
>
> Unfortunately that give me a 'syntax error' but your response has reminded
> me that I don't have an actual ans= statement and I know I must have but
> what and where?  I'm getting way to old to learn this stuff!
>
> Any other assistance would be greatly appreciated.
>
> cheers
> Pam
>
>
>>
>> Hi Pam,
>>
>> Try changing the following line:
>> MsgBox "Are you sure you want to remove this child?", vbYesNo
>>
>> to this:
>> ans = MsgBox "Are you sure you want to remove this child?", vbYesNo
>>
>> I think that should fix your problems.  (You just need to assign the
>> return value to your variable in order to be able to use it)
>>
>> Scott
>>
>>
>> -- 
>> Maistrye
>> ------------------------------------------------------------------------
>> Maistrye's Profile:
>> http://www.excelforum.com/member.php?action=getinfo&userid=36078
>> View this thread: 
>> http://www.excelforum.com/showthread.php?threadid=563931
>>
>
> 


0
7/22/2006 5:03:37 AM
Reply:

Similar Artilces:

Forcing BCC in outbound messages
Is there any way to force emails going out from a specific exhange 2003 recipient (via public folders) to BCC ONLY...not allow emails to go out as carbon copies to everyone, or with everyone in the "to" field? We've had some problems in the past with some company distributions that someone decides to CC the customers, instead of BCC'ing them, and that goes over really well...:) On Fri, 24 Feb 2006 07:20:57 -0500, "Bill Oliman" <boliman@earthlink.net> wrote: >Is there any way to force emails going out from a specific exhange 2003 >recipient (via pub...

Filter to select from various fields on opening a form
I have a form called TDC and want to filter data in the following fields on opening the form: DiaryAction (text field); DiaryCategory (text field); DiarySubCategory (text field); Company (text field); ContactType (text field); DiaryItemClosed (a Yes/No field). At the same time, I want the option not to select anything in each of these fields. Please could somebody give me the steps to do this. I am doing this in Access 2007, but am creating it as an Access 2003 database. Thank you for any help. I meant to say that I want this from dropdown boxes, but forgot to say becau...

How do I create project schedule using excel
I need to create a project schedule using excel. Please help. Hi lack of details :-) Maybe give some more information what you're trying to do? -- Regards Frank Kabel Frankfurt, Germany raeisza wrote: > I need to create a project schedule using excel. Please help. ...

Printing an Excel doucument
In this example, I have a document of 100 pages, when I print the document, the column headers only print on the first page and not the subsequent pages. also I would like all the pages to be numbered. is therea fix for this? Hi Richard, For your first question goto File>Page Setup>Sheet tab and look for the option 'Rows to repeat at top' For your second question goto View>Header and Footer and look at the &[page] and &[pages] options in your footer. HTH Martin ...

my printer ejects a blank sheet prior to printing with EXCEL
...

Excel: extract and sum numerals from mixed text/numeral cell range
I have a large (30x20) grid of cells with data, and I want to extract and then sum up certain numerals from this entire range. The catch is that the data is mixed numerals and text, as you'll see below. Here's an abbreviated 3x3 example, with a value in each of the nine cells: V7.1 T H P1 A T B V3 P4.5 If I just wanted to sum up the instances of "T" appearing, I could use COUNTIF() for the entire range to come up with answer ("T" appears 2 times). Easy enough. But, what I'm trying to accomplish is to sum up the numerals associated w...

Error in formula displayed for linear and 2nd order curve fits in Excel 2003
I have created trendlines for some pretty simple data using both 2nd order polynomial and linear fits. In both cases, the displayed formulas have their 1st and 2nd order coefficients wrong by a factor of 10!! (I have read lots of posts about increasing precision but this is not what I am up against). Has anyone seen this? What version of Excel? Could you include the data in a follow up post (not as an attachment), along with the coefficients you've computed? - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierT...

how do i form 2 lines in 1 row?
I'm guessing you're looking to force text in a cell to wrap into the next line of the same cell. If that's true...... Edit the text and move the insertion point to where you want to wrap the text. Hold down the [Alt] key and press [Enter] Does that help? ---------------------------------- Regards, Ron Microsoft MVP (Excel) "MSEXCELROOKIE" <MSEXCELROOKIE@discussions.microsoft.com> wrote in message news:951AA059-1613-4A62-AAA6-7890AF6F84A6@microsoft.com... > In one cell type this is line one then Alt + ENTER then type this is line two. The Alt ...

Error opening form
Hi, I am trying to open a form from a switchboard and I get this error message: "MSACCESS exe has generated errors and will be closed by windows. You will need to restart the program. An error log is being created." I restart the computer and it's fixed. but it keeps happening. Does anyone know the solution? I have Microsoft Office 2000 thanks -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200709/1 There are many, many things that could be causing this. Work through the list in this article: Preventing corruption ...

Windows Update
My problem is similar to someone else's below(about Excel 2003 not being able to update), the only difference is that I don't want Excel to update at all. I don't even use it. But the yellow shield kept telling me that it had 1 update available, which was Excel 2003, so, out of annoyance, I installed it. After failing to install several times, I decided to uninstall Excel from Microsoft Office(Pro Edition 2003). Even after uninstalling Excel, I still got the windows update alert. How do I stop it? Extra info: When windows update first appeared, I did a custom instal...

how can I avoid missing WM_LBUTTONUP message?
Hello, Inside my WM_LBUTTONDOWN handler, I call SetCapture() so that if the user moves off my control before letting up on the mouse button, I will still receive the WM_LBUTTONUP message. Inside my WM_LBUTTONUP handler, I'm calling ReleaseCapture. However, it seems if the user presses down on the mouse, and then a MessageBox pops up before he lets up on the mouse, I am not getting the WM_LBUTTONUP message. My assumption is that the MessageBox is reclaiming the capture, and my control is losing it. I am aware that I can be alerted of this condition by handling WM_CAPTURECHANGED. I&#...

excel axes
how do I create a secondary horizontal axis on an xy scatter plot? forgot to mention 2008 excel using Leopard (10.5.2) ...

Excel program
I have a simple program in excel for data entry. When I protect the sheet, and use tab to move about within the spreadsheet, sometimes the tab button will not move the cursor to the next cell. It will pick a random cell to go to next. Is there a way that I can designate what cell it will go to next. Thanks for your help, jb On a protected sheet, it is going to the next unprotected cell. So, if you don't want it to go to a cell, protect it. "JB" <jgblanton@hotmail.com> wrote in message news:093a01c391d0$ae57f190$a301280a@phx.gbl... > I have a simple program in exce...

Messages Recovery Miscrosoft Outlook 2000
How Can I do recover a messages deleted permanent ? The messages was sent to delete messages and then this folder was empty You can try the following; http://www.howto-outlook.com/howto/restoredeleteditemsfromanoutlookpst.htm -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Service Pack 1 ----- "jk" <anonymous@discussions.microsoft.com> wrote in message news:5c8a01c49202$c2b9e890$a601280a@phx.gbl... > How Can I do recover a messages deleted permanent ? The > mes...

2003 Excel and 2007 Trial Version Excel
I downloaded the 2007 trial version of Microsoft Office. Now my trial is over and I reloaded my 2003 version. But it will not let me remove the 2007 trial version. Also when I go into my 2003 Excel a Window Installer box comes up that says Preparing to install and this stays on for about 5 minutes before it goes away. I know that I should not have downloaded the trial version but I did. Can someone please help me. I have Windows XP and it is my office computer. Please help! ...

Creating a Chart from Cells that use a List Box
Hi, I am trying to create a number of charts (e.g., pie, line etc) based on data that is slelected from a list box (i.e., data validation). What i would like to do is create the charts before any data is entered (if that makes sense) and as data is entered the charts will display this. ...

Error Message When opening Excel
I am using Windows VISTA 64 bit O/S with Office Professional 2003 All of a sudden I started to get the following error message: 'One of your object libraries (Stdole32.tlb) is missing or damaged. Please run setup to install it' I am at a loss as how to correct this. I checked online and found some instructions that were for Windows 2000 Those did not work for VISTA at all. Thank you in advance for your support and suggestions, HankL It is telling you to do a "setup to install" on the Office product, did you try that? Did you try doing a repair on ...

MFC: Excel Automation Can't Quit from Excel. Please help...
Hi I use MFC Visual C++ 4.2. I am automating Excel from my application. My problem is I cannot quit the Excel after the automation process finished! I checked it still exists on the Process lists and the most DANGEROUS is everytime the automation function run, it create other Excel and so on. So it must be out of memory soon. I have used the app.Quit() method like all the people used but it DOES NOT work. What should I do? Thank you. I happened to answer this on the office.developer.vba newsgroup. You most likely have neglected to Release() the automation object. joe On Wed, 3 Sep...

Excel number / date conversion
I've just pulled some data out of an ODBC connection into Access an then exported it to Excel. The dates are currently in the format 20031109. But the built in dat convertor (from Format Cells) doesn't do anything, even if I convert i to a 'proper' number first. How can I convert this to 09/11/2003 so that I can do some date - base arithmetic and work out difference in days -- markperr ----------------------------------------------------------------------- markperry's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2759 View this thread: http://w...

Excel charts should allow "switching" series on or off
A plot (chart) of time series data may be used for many purposes. From my use two reasons I use such plots are: Studying individual time series trends; and Overall impression of all results. But when studying multiple time series data a chart can become cluttered. It would be useful if individual series could be seleceted as visible or invisible so that they could be evaluated without losing the total plot. At the moment the only way to "unclutter" the plot is to remove the temporaily-unwanted series but it can be time consuming to reconstruct the plot. ---------------- Thi...

form won't allow input -- it did previously
Two of us have been designing a form, which all of a sudden has stopped allowing any data to be put into it. One can still add data, of course, to the underlying table (there are 2 tables). I checked the Properties for the form and I don't see where data entry is restricted/denied. What could have happened?? Thanks, Meredith In news:AD694662-ED63-4E91-98EA-663D93B9B6A9@microsoft.com, MeredithS <MeredithS@discussions.microsoft.com> wrote: > Two of us have been designing a form, which all of a sudden has > stopped allowing any data to be put into it. One can still add dat...

Email from Excel #3
Is it possible to have Excel send an email if the value of a certain cell is changed? Hi see your post in public.excel -- Regards Frank Kabel Frankfurt, Germany "berj" <berj@adelphia.net> schrieb im Newsbeitrag news:CcSdndsVDJy4jcjcRVn-pQ@adelphia.com... > Is it possible to have Excel send an email if the value of a certain cell is > changed? > > ...

version excel
bonjour a tous, & a tous les pro bien sur es qu'il est possible ,que des l'instant on modifie le code VBA EXCEL on incremente un compteur pour les mise a jour cela me semble plus simple merci pour vos reponse patrick.villa@laposte.net +++++ http://www.mcgimpsey.com/excel/udfs/sequentialnums.html -- --- HTH Bob (change the xxxx to gmail if mailing direct) "pounet" <patrick.villa@laposte.net> wrote in message news:1165418782.552172.169740@j44g2000cwa.googlegroups.com... > bonjour a tous, & a tous les pro bien sur > > es qu'il est possible ,qu...

double line spacing using excel 2000
I have a paragraph of writing, how do i get the text to be double line spaced? I am using excel 2000. Excel doesn't have a line spacing setting. You could add line breaks by pressing Alt+Enter at the end of a line, then another Alt+Enter to create a blank line. Dan wrote: > I have a paragraph of writing, how do i get the text to be double line > spaced? I am using excel 2000. -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html Does this aply to newer versions of excel? "Debra Dalgleish" wrote: > Excel doesn't have a...

Excel 95 to Excel 2003
Anyone know if it's possible to convert Excel 95 files to Excel 2003? If so, how. Thanks in advance Open the file in 2003 and SAVE as you would a file created in 2003. If not absolutely positive, save as a different name. -- Don Guillett SalesAid Software donaldb@281.com "Cooper" <kcooper2@austin.rr.com> wrote in message news:uqLpEuG4EHA.1292@TK2MSFTNGP10.phx.gbl... > Anyone know if it's possible to convert Excel 95 files to Excel 2003? If > so, how. > > Thanks in advance > > Open in XL 2003, when you close it, it should, ask you if you w...