Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Inputbox's and Prompt value

I want to create an inputbox with the prompt values being listed from cell
values on a worksheet. So say I have range("a2:a10") filled with values that
I would like to display as the prompt of the inputbox. Is this possible to do?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Inputbox's and Prompt value

Hi Kryer,

It is not clear what you want to achieve, but to use a cell value as the
prompt for an input box, try something like:

Public Sub nTest()
Dim res As Variant

res = InputBox(prompt:=ActiveSheet.Range("A2").Value)

End Sub

Depending on what you want to do, the prompt could represent a concatenation
of cell values.

Public Sub nTest2()
Dim res As Variant
Dim sStr As String

With ActiveSheet
sStr = .Range("A1").Value & " " & .Range("A2").Value _
& " " & .Range("A3").Value '...
End With

res = InputBox(prompt:=sStr)

End Sub

Alternatively, input boxes could be shown with successive cell values as the
prompt, by looping through the cells:

Public Sub nTest3()
Dim res As Variant
Dim rng As Range
Dim rCell As Range

Set rng = ActiveSheet.Range("A2:A10")

For Each rCell In rng.Cells
res = InputBox(prompt:=rCell.Value)
Next rCell

End Sub

If the above does not help, post back with more detail of your requirements.

---
Regards,
Norman



"Kryer" wrote in message
...
I want to create an inputbox with the prompt values being listed from cell
values on a worksheet. So say I have range("a2:a10") filled with values
that
I would like to display as the prompt of the inputbox. Is this possible to
do?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Inputbox's and Prompt value

I am trying to do something like that of the concatenation style but saying
to do it with all cells from A2:A30 with out having to enter in each of the
range values by hand like with your example. Is this going to be the only way
I can do this. What I am trying to do in the end is add a new name without
duplication of it in the list. Do you have another idea about this.

"Norman Jones" wrote:

Hi Kryer,

It is not clear what you want to achieve, but to use a cell value as the
prompt for an input box, try something like:

Public Sub nTest()
Dim res As Variant

res = InputBox(prompt:=ActiveSheet.Range("A2").Value)

End Sub

Depending on what you want to do, the prompt could represent a concatenation
of cell values.

Public Sub nTest2()
Dim res As Variant
Dim sStr As String

With ActiveSheet
sStr = .Range("A1").Value & " " & .Range("A2").Value _
& " " & .Range("A3").Value '...
End With

res = InputBox(prompt:=sStr)

End Sub

Alternatively, input boxes could be shown with successive cell values as the
prompt, by looping through the cells:

Public Sub nTest3()
Dim res As Variant
Dim rng As Range
Dim rCell As Range

Set rng = ActiveSheet.Range("A2:A10")

For Each rCell In rng.Cells
res = InputBox(prompt:=rCell.Value)
Next rCell

End Sub

If the above does not help, post back with more detail of your requirements.

---
Regards,
Norman



"Kryer" wrote in message
...
I want to create an inputbox with the prompt values being listed from cell
values on a worksheet. So say I have range("a2:a10") filled with values
that
I would like to display as the prompt of the inputbox. Is this possible to
do?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Inputbox's and Prompt value

If you have xl2000 or later

Sub AA()
Dim v as Variant, a as String
Dim res as String
v = Application.Transpose(Range("A2:A10"))
a = Join(v,chr(10))
res = InputBox(a)
End Sub

If you just want to concatenate the values, replace Chr(10) with " " or ""

--
Regards,
Tom Ogilvy

"Kryer" wrote in message
...
I want to create an inputbox with the prompt values being listed from cell
values on a worksheet. So say I have range("a2:a10") filled with values

that
I would like to display as the prompt of the inputbox. Is this possible to

do?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Inputbox's and Prompt value

Thanks this is what i was looking for

"Tom Ogilvy" wrote:

If you have xl2000 or later

Sub AA()
Dim v as Variant, a as String
Dim res as String
v = Application.Transpose(Range("A2:A10"))
a = Join(v,chr(10))
res = InputBox(a)
End Sub

If you just want to concatenate the values, replace Chr(10) with " " or ""

--
Regards,
Tom Ogilvy

"Kryer" wrote in message
...
I want to create an inputbox with the prompt values being listed from cell
values on a worksheet. So say I have range("a2:a10") filled with values

that
I would like to display as the prompt of the inputbox. Is this possible to

do?





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
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
Help on Prompt Zubair Excel Worksheet Functions 0 January 17th 05 09:15 AM
Prompt for Value halem2[_53_] Excel Programming 1 November 16th 04 07:07 PM
Prompt for Value halem2[_52_] Excel Programming 0 November 16th 04 02:14 PM
Prompt for Value halem2[_51_] Excel Programming 1 November 16th 04 02:07 PM


All times are GMT +1. The time now is 12:21 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"