How to return address of the column or cell I selected from Application.Inputbox, not just return the value?
Thanks Guys![]()
Categorycolumn = Application.InputBox("Which column do you want select?", "Column") MsgBox Categorycolumn
How to return address of the column or cell I selected from Application.Inputbox, not just return the value?
Thanks Guys![]()
Categorycolumn = Application.InputBox("Which column do you want select?", "Column") MsgBox Categorycolumn
![]()
Dim categorycolumn As Long categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Column MsgBox categorycolumn
Thanks,
Solus
Please remember the following:
1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.Highlight the code in your post and press the # button in the toolbar.2. Show appreciation to those who have helped you by clickingbelow their posts.
3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.
"Slow is smooth, smooth is fast."
Thank you so much. However, what if I want to add more status as shown below? When I pressed Cancel or Ok without selecting, error prompt always shows up.
![]()
a: Categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Column Select Case Categorycolumn Case False Exit Sub Case "" MsgBox "You have to select!" GoTo a Case Else MsgBox Categorycolumn End Select
What did you declare Categorycolumn as? Please include the entire code.
sorry
![]()
Dim Categorycolumn As Integer a: Categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Column Select Case Categorycolumn Case False Exit Sub Case "" MsgBox "You have to select!" GoTo a Case Else MsgBox Categorycolumn End Select
If you click okay with a blank inputbox its going to tell you your input is incorrect and give you the option to correct (native function of inputbox).
Your only options will be input a range and click okay or hit cancel and exit.
![]()
Dim categorycolumn As Long On Error Resume Next categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Column On Error GoTo 0 If categorycolumn > 0 Then MsgBox categorycolumn End If
e/ I just noticed the title says return the ADDRESS of the column or cell you selected and not the column number. Are you looking for the address of the selected cell (i.e. C5)?
Sorry for not paying attention.
Last edited by Solus Rankin; 08-18-2014 at 02:02 PM.
It's ok. Actually, you already solved my next step. The address I was looking for actually is for returning the Column number.
But, could you please tell me how to return address as well? I appreciate for your helping.
![]()
Dim categorycolumn As String On Error Resume Next categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Address(False, False) On Error GoTo 0 If categorycolumn <> "" Then MsgBox categorycolumn End If
great! Thank you so much!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks