Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Question about Input Box and how to use the entered value

How do I use the value a user enters in an Input Box as a variable? What
I'd like to do is use an Input Box where the user enters in the cell address
of the top-left cell in the table they wish to work with. For example they
might type in A1 or B3, etc. Then I want to be able to select that cell
based on what the user types. Can it only be a string value? Any tips
appreciated. Thanks!

-gk-


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Question about Input Box and how to use the entered value

If you use the Application.InputBox you can specify the type of
value to return. Setting type:=8 allows the user to enter (or
select, using the GUI) a cell reference. For example:

Dim rng As Range
Set rng = Application.InputBox( _
Prompt:="Enter or select range:" & vbNewLine, _
Title:="Enter Range", _
Type:=8)
Application.Goto rng(1)




In article ,
"TBA" wrote:

How do I use the value a user enters in an Input Box as a variable? What
I'd like to do is use an Input Box where the user enters in the cell address
of the top-left cell in the table they wish to work with. For example they
might type in A1 or B3, etc. Then I want to be able to select that cell
based on what the user types. Can it only be a string value? Any tips
appreciated. Thanks!

-gk-


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 280
Default Question about Input Box and how to use the entered value

Sub Main()
Dim s As String
s = InputBox("Enter something")
MsgBox "String entered: " & s
MsgBox "Numeric value of string entered: " & CStr(Val(s))
End Sub

--
Bob Kilmer


"TBA" wrote in message
...
How do I use the value a user enters in an Input Box as a variable? What
I'd like to do is use an Input Box where the user enters in the cell

address
of the top-left cell in the table they wish to work with. For example

they
might type in A1 or B3, etc. Then I want to be able to select that cell
based on what the user types. Can it only be a string value? Any tips
appreciated. Thanks!

-gk-




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 280
Default Question about Input Box and how to use the entered value

'Actually, the InputBox method of the Application
'object has more Excel friendly options.
'Note the type specifier.
'Put your cursor on Application.InputBox
'and hit F1 for details.

Option Explicit

Sub Main()
'This uses the VBA InputBox.
Dim s As String
s = VBA.InputBox("Enter something")
MsgBox "String entered: " & s
MsgBox "Numeric value of String: " & CStr(Val(s))

'This uses the InputBox method of the Application object.
Dim r As Range
Set r = Application.InputBox( _
prompt:="Enter a range reference", Type:=8)
MsgBox "Range Returned: " & r.AddressLocal

End Sub


--
Bob Kilmer


"TBA" wrote in message
...
How do I use the value a user enters in an Input Box as a variable? What
I'd like to do is use an Input Box where the user enters in the cell

address
of the top-left cell in the table they wish to work with. For example

they
might type in A1 or B3, etc. Then I want to be able to select that cell
based on what the user types. Can it only be a string value? Any tips
appreciated. Thanks!

-gk-




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
Avoiding error on Input Box - if no value is entered dhstein Excel Discussion (Misc queries) 5 April 25th 09 12:43 PM
Code to Query SQL Server with a parameter value (entered into an Input Box), and have that value also display in a selected cell on a worksheet Doctorjones_md Excel Discussion (Misc queries) 3 June 27th 07 04:14 PM
Code to Query SQL Server with a parameter value (entered into an Input Box), and have that value also display in a selected cell on a worksheet Doctorjones_md Excel Worksheet Functions 3 June 27th 07 04:14 PM
Input Date when data is entered into another cell GaryByrd Excel Worksheet Functions 2 February 1st 05 12:37 AM
Input box question losmac Excel Programming 0 August 20th 03 10:32 PM


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