#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Message Box

I have wrote a basic macro.

What I wanna do is have a box pop up doing the following 3
things:

1 -Saying please enter id (this will enter an id into a
selected cell, type in number then click button ok)

2 -Button saying Dont know id which wil leave the cell
blank

or 3 -Button saying Cancel (this will cancel the macro and
I will assign code to undo the original macro.)

Hope you can help me

Many thanks




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Message Box

Hi

Instead of using a cell for entry, try

Sub test()
Dim S As String
S = InputBox("ID please:")
Select Case S
Case "***" 'OK
MsgBox "ID accepted"
Case "" 'Cancelled
Case Else 'wrong
MsgBox "Wrong ID. You're fired.", vbInformation
End Select
End Sub

HTH. best wishes Harald

"Walshy" skrev i melding
...
I have wrote a basic macro.

What I wanna do is have a box pop up doing the following 3
things:

1 -Saying please enter id (this will enter an id into a
selected cell, type in number then click button ok)

2 -Button saying Dont know id which wil leave the cell
blank

or 3 -Button saying Cancel (this will cancel the macro and
I will assign code to undo the original macro.)

Hope you can help me

Many thanks






  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Message Box


Hi Harold this is great but I want it to return the value
entered in the box onto the selected cell in the
worksheet. also the project number entered could be
anything...

basically what I am doing is I have a table. and when the
user wants to add a new record they click a button and a
macro inserts a row at the first blank copies the formulas
etc from the row above and pastes them into the new row..
The formulas are all vlookups from the first cell so in
the macro I want a box to pop up (as your macro done fine)
and then the user will enter the number into this and then
click ok then this will return the value into the
worksheet and the lookups will all pick up from that. If
they dont know the code the have a button saying that to
leave the row blank or finally cancel which would then
delete the new row and cancel the macro so it goes back to
how it was.

Sorry I should of wrote that originally !!! doh !!! Hope
you can help me... Thankx

PS like the msgbox about your fired !! haha

-----Original Message-----
Hi

Instead of using a cell for entry, try

Sub test()
Dim S As String
S = InputBox("ID please:")
Select Case S
Case "***" 'OK
MsgBox "ID accepted"
Case "" 'Cancelled
Case Else 'wrong
MsgBox "Wrong ID. You're fired.", vbInformation
End Select
End Sub

HTH. best wishes Harald

"Walshy" skrev i melding
...
I have wrote a basic macro.

What I wanna do is have a box pop up doing the

following 3
things:

1 -Saying please enter id (this will enter an id into a
selected cell, type in number then click button ok)

2 -Button saying Dont know id which wil leave the cell
blank

or 3 -Button saying Cancel (this will cancel the macro

and
I will assign code to undo the original macro.)

Hope you can help me

Many thanks






.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Message Box

Hi

Instead of
MsgBox "ID accepted"
use
ActiveCell.Value = S

But with all this action and validation, I suggest you o create a userform.
See this tutorial here
http://www.dicks-blog.com/excel/2004...g_userfor.html

HTH. best wishes Harald

skrev i melding
...

Hi Harold this is great but I want it to return the value
entered in the box onto the selected cell in the
worksheet. also the project number entered could be
anything...

basically what I am doing is I have a table. and when the
user wants to add a new record they click a button and a
macro inserts a row at the first blank copies the formulas
etc from the row above and pastes them into the new row..
The formulas are all vlookups from the first cell so in
the macro I want a box to pop up (as your macro done fine)
and then the user will enter the number into this and then
click ok then this will return the value into the
worksheet and the lookups will all pick up from that. If
they dont know the code the have a button saying that to
leave the row blank or finally cancel which would then
delete the new row and cancel the macro so it goes back to
how it was.

Sorry I should of wrote that originally !!! doh !!! Hope
you can help me... Thankx

PS like the msgbox about your fired !! haha

-----Original Message-----
Hi

Instead of using a cell for entry, try

Sub test()
Dim S As String
S = InputBox("ID please:")
Select Case S
Case "***" 'OK
MsgBox "ID accepted"
Case "" 'Cancelled
Case Else 'wrong
MsgBox "Wrong ID. You're fired.", vbInformation
End Select
End Sub

HTH. best wishes Harald

"Walshy" skrev i melding
...
I have wrote a basic macro.

What I wanna do is have a box pop up doing the

following 3
things:

1 -Saying please enter id (this will enter an id into a
selected cell, type in number then click button ok)

2 -Button saying Dont know id which wil leave the cell
blank

or 3 -Button saying Cancel (this will cancel the macro

and
I will assign code to undo the original macro.)

Hope you can help me

Many thanks






.



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
Message JG Excel Worksheet Functions 3 December 28th 06 02:51 PM
If then Message Box Nikki Excel Discussion (Misc queries) 8 December 22nd 05 02:41 PM
Message Box "Value" saziz Excel Discussion (Misc queries) 10 July 20th 05 03:58 AM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM
Displaying a message in a message box without requiring user to click anything to proceed Android[_2_] Excel Programming 2 June 25th 04 06:44 PM


All times are GMT +1. The time now is 04:31 PM.

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

About Us

"It's about Microsoft Excel"