Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
'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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Avoiding error on Input Box - if no value is entered | Excel Discussion (Misc queries) | |||
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 | Excel Discussion (Misc queries) | |||
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 | Excel Worksheet Functions | |||
Input Date when data is entered into another cell | Excel Worksheet Functions | |||
Input box question | Excel Programming |