LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Referencing cells with input boxes.

Hi George,

Look in VBA help at the InputBox Function and the InputBoxMethod.

As the syntax for either is relatively straightforward, perhaps the best
additional source would be the NG archives. If you perform a Google Groups
search, I am sure that you will find a wide range of practical usage and
syntactical style.

The following is a simple example which uses the InputBox Fnction which may
suffice for your immediate scenario.

Sub XYZ()
Dim rngDest As Range
Dim res As String, res2 As Long
Dim blRetry As Boolean
Dim msgCancel
Dim msgBlank
Dim msgRetry
Dim msgNoNumber

msgCancel = "You cancelled"
msgBlank = "You clicked OK without entering anything"
msgNoNumber = " is not a number."

blRetry = True

Set rngDest = Range("A1") '<<=== Destination for User Input
Do While blRetry
If Not blRetry Then GoTo XIT
res = InputBox("{Please Enter A number")
If StrPtr(res) = 0 Then
msgbox msgCancel
ElseIf Len(res) = 0 Then
msgbox msgBlank
ElseIf Not IsNumeric(res) Then
msgbox """" & res & """" & msgNoNumber
Else
msgbox "You entered " & res
rngDest.Value = res
Exit Sub
End If
res2 = msgbox("Do you want to try again?", vbYesNo)

blRetry = res2 = vbYes

Loop

XIT:
msgbox "You opted to terminate " & _
"without making a valid entry"
End Sub


---
Regards,
Norman



"George Sherman" wrote in message
...
Please help this newbie. I want to get a number from a user and transfer
that
number to a cell in my worksheet so I can use that number in other
formulas.
Any good suggestions or good reference material I might access would be
greatfully and humbly appreciated.

George



 
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
Input boxes James Excel Discussion (Misc queries) 5 July 23rd 08 07:49 PM
How do I add input data in the input ranges in drop down boxes. oil_driller Excel Discussion (Misc queries) 1 November 9th 05 10:31 PM
Input Boxes carvil16[_2_] Excel Programming 2 January 20th 04 10:19 PM
Can anyone help with input boxes? index[_10_] Excel Programming 3 December 6th 03 12:23 AM
Mask input in input boxes? Eric[_14_] Excel Programming 4 November 29th 03 11:10 AM


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