Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 31
Default Another InputBox question...

Hi all,

Is it possible to include the result of a formula as part of the
message in an InputBox?

This is what I need to do:

1. I'm designing a spreadsheet which randomly selects the name of a
ship from a list.
2. Having performed that, the user then needs to input the number of
crew on the selected ship - this is done via an InputBox in VBA.
3. However, the user needs to know what ship has been selected, so I
would like that to be displayed as part of the InputBox message - is
that possible?

The random selection is done using =RANDBETWEEN, as all the ships have
a number as well as a name: these are stored as two columns in the
worksheet and the random function uses the lower and upper numbers of
the ships. A vlookup is then performed to derive the ship's name.

I'd be quite happy if the InputBox statement is performed after the
random selection and the vlookup are done, thus leaving the ship's
name in a cell - then, (if it can be done), to refer to the contents
of that cell as part of the InputBox message, to create something
like.....

"The ship selected is "& A1 &" Please enter the crew complement for
this ship"

.... where cell A1 would contain the vlookup formula

I've tried various ways before posting this, but so far come up blank
- perhaps someone can tell me if it is indeed possible in VBA before I
lose the will to live!

Many thanks

Phil

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,073
Default Another InputBox question...

On Apr 12, 12:58 am, "Phil" wrote:
Hi all,

Is it possible to include the result of a formula as part of the
message in an InputBox?

This is what I need to do:

1. I'm designing a spreadsheet which randomly selects the name of a
ship from a list.
2. Having performed that, the user then needs to input the number of
crew on the selected ship - this is done via an InputBox in VBA.
3. However, the user needs to know what ship has been selected, so I
would like that to be displayed as part of the InputBox message - is
that possible?

The random selection is done using =RANDBETWEEN, as all the ships have
a number as well as a name: these are stored as two columns in the
worksheet and the random function uses the lower and upper numbers of
the ships. A vlookup is then performed to derive the ship's name.

I'd be quite happy if the InputBox statement is performed after the
random selection and the vlookup are done, thus leaving the ship's
name in a cell - then, (if it can be done), to refer to the contents
of that cell as part of the InputBox message, to create something
like.....

"The ship selected is "& A1 &" Please enter the crew complement for
this ship"

... where cell A1 would contain the vlookup formula

I've tried various ways before posting this, but so far come up blank
- perhaps someone can tell me if it is indeed possible in VBA before I
lose the will to live!

Many thanks

Phil


Hi Phil,

It does work, try...

"The ship selected is " & Range("A1").Value &". Please enter the crew
complement for this ship"

for the inputbox prompt.

Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Another InputBox question...

"The ship selected is "& Range("A1").Value & vbNewLine & _
"Please enter the crew complement for this ship"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Phil" wrote in message
oups.com...
Hi all,

Is it possible to include the result of a formula as part of the
message in an InputBox?

This is what I need to do:

1. I'm designing a spreadsheet which randomly selects the name of a
ship from a list.
2. Having performed that, the user then needs to input the number of
crew on the selected ship - this is done via an InputBox in VBA.
3. However, the user needs to know what ship has been selected, so I
would like that to be displayed as part of the InputBox message - is
that possible?

The random selection is done using =RANDBETWEEN, as all the ships have
a number as well as a name: these are stored as two columns in the
worksheet and the random function uses the lower and upper numbers of
the ships. A vlookup is then performed to derive the ship's name.

I'd be quite happy if the InputBox statement is performed after the
random selection and the vlookup are done, thus leaving the ship's
name in a cell - then, (if it can be done), to refer to the contents
of that cell as part of the InputBox message, to create something
like.....

"The ship selected is "& A1 &" Please enter the crew complement for
this ship"

... where cell A1 would contain the vlookup formula

I've tried various ways before posting this, but so far come up blank
- perhaps someone can tell me if it is indeed possible in VBA before I
lose the will to live!

Many thanks

Phil



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 31
Default Another InputBox question...

On 11 Apr, 16:22, "Bob Phillips" wrote:
"The ship selected is "& Range("A1").Value & vbNewLine & _
"Please enter the crew complement for this ship"

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Phil" wrote in message

oups.com...



Hi all,


Is it possible to include the result of a formula as part of the
message in an InputBox?


This is what I need to do:


1. I'm designing a spreadsheet which randomly selects the name of a
ship from a list.
2. Having performed that, the user then needs to input the number of
crew on the selected ship - this is done via an InputBox in VBA.
3. However, the user needs to know what ship has been selected, so I
would like that to be displayed as part of the InputBox message - is
that possible?


The random selection is done using =RANDBETWEEN, as all the ships have
a number as well as a name: these are stored as two columns in the
worksheet and the random function uses the lower and upper numbers of
the ships. A vlookup is then performed to derive the ship's name.


I'd be quite happy if the InputBox statement is performed after the
random selection and the vlookup are done, thus leaving the ship's
name in a cell - then, (if it can be done), to refer to the contents
of that cell as part of the InputBox message, to create something
like.....


"The ship selected is "& A1 &" Please enter the crew complement for
this ship"


... where cell A1 would contain the vlookup formula


I've tried various ways before posting this, but so far come up blank
- perhaps someone can tell me if it is indeed possible in VBA before I
lose the will to live!


Many thanks


Phil- Hide quoted text -


- Show quoted text -


Thanks Bob and Ken - both work a treat, and exactly what I needed.

Best wishes,

Phil

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,073
Default Another InputBox question...

You're welcome Phil.
Thanks for the feedback.

Ken Johnson



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
inputbox brownti via OfficeKB.com Excel Discussion (Misc queries) 2 February 9th 07 02:37 PM
msgbox / inputbox etc samenvoegen van sheets Excel Discussion (Misc queries) 2 March 16th 06 08:56 AM
msgbox / inputbox etc samenvoegen van sheets Setting up and Configuration of Excel 1 March 15th 06 03:32 PM
Inputbox with VBA Jeff Excel Discussion (Misc queries) 3 January 19th 06 05:18 PM
inputbox question redb Excel Discussion (Misc queries) 0 October 6th 05 02:57 PM


All times are GMT +1. The time now is 09:46 AM.

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"