Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default Returning a cell address in a msgbox, by selection via inputbox Ty

I want to use a Type:=8 Inputbox allowing the user to select a cell and then
later on using the address of the range/cell selected so as a string.

For example:

Sub test()
Dim rng3 As String
rng3 = Application.InputBox(prompt:="Select rng1", Type:=8)
MsgBox (rng3)
End Sub

returns the value that is inside the cell selected instead of the actual
address of the cell. In other words upon first prompt if the user selects the
cell A1, the second prompt displays the contents of A1 but not "A1".

Thanx in advance for all your help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Returning a cell address in a msgbox, by selection via inputbox Ty

You were very close:

Sub GetAddy()
Dim rng As Range
Dim st As String
Set rng = Application.InputBox(prompt:="select a range", Type:=8)
MsgBox (rng.Address)
End Sub


Note that the User has the option of either typing in range address in the
inputbox or selecting it with the mouse instead!
--
Gary''s Student - gsnu200844


"FARAZ QURESHI" wrote:

I want to use a Type:=8 Inputbox allowing the user to select a cell and then
later on using the address of the range/cell selected so as a string.

For example:

Sub test()
Dim rng3 As String
rng3 = Application.InputBox(prompt:="Select rng1", Type:=8)
MsgBox (rng3)
End Sub

returns the value that is inside the cell selected instead of the actual
address of the cell. In other words upon first prompt if the user selects the
cell A1, the second prompt displays the contents of A1 but not "A1".

Thanx in advance for all your help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default Returning a cell address in a msgbox, by selection via inputbo

Thanx Gary!

A genius like u couldn't be a student!. However, why have u declared the
variable "st"?

"Gary''s Student" wrote:

You were very close:

Sub GetAddy()
Dim rng As Range
Dim st As String
Set rng = Application.InputBox(prompt:="select a range", Type:=8)
MsgBox (rng.Address)
End Sub


Note that the User has the option of either typing in range address in the
inputbox or selecting it with the mouse instead!
--
Gary''s Student - gsnu200844


"FARAZ QURESHI" wrote:

I want to use a Type:=8 Inputbox allowing the user to select a cell and then
later on using the address of the range/cell selected so as a string.

For example:

Sub test()
Dim rng3 As String
rng3 = Application.InputBox(prompt:="Select rng1", Type:=8)
MsgBox (rng3)
End Sub

returns the value that is inside the cell selected instead of the actual
address of the cell. In other words upon first prompt if the user selects the
cell A1, the second prompt displays the contents of A1 but not "A1".

Thanx in advance for all your help.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Returning a cell address in a msgbox, by selection via inputbo

I was going to:

st=rng.Address
MsgBox(st)

but it is not necessary unless you need to "remember" the address.
--
Gary''s Student - gsnu200844


"FARAZ QURESHI" wrote:

Thanx Gary!

A genius like u couldn't be a student!. However, why have u declared the
variable "st"?

"Gary''s Student" wrote:

You were very close:

Sub GetAddy()
Dim rng As Range
Dim st As String
Set rng = Application.InputBox(prompt:="select a range", Type:=8)
MsgBox (rng.Address)
End Sub


Note that the User has the option of either typing in range address in the
inputbox or selecting it with the mouse instead!
--
Gary''s Student - gsnu200844


"FARAZ QURESHI" wrote:

I want to use a Type:=8 Inputbox allowing the user to select a cell and then
later on using the address of the range/cell selected so as a string.

For example:

Sub test()
Dim rng3 As String
rng3 = Application.InputBox(prompt:="Select rng1", Type:=8)
MsgBox (rng3)
End Sub

returns the value that is inside the cell selected instead of the actual
address of the cell. In other words upon first prompt if the user selects the
cell A1, the second prompt displays the contents of A1 but not "A1".

Thanx in advance for all your help.

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
Help with InputBox and MsgBox Ann New Users to Excel 2 April 11th 07 03:46 PM
inputBox calculations and msgbox or "outputBox" CC Excel Worksheet Functions 0 July 14th 06 09:11 AM
msgbox / inputbox etc samenvoegen van sheets Excel Discussion (Misc queries) 2 March 16th 06 08:56 AM
msgbox / inputbox etc samenvoegen van sheets Excel Worksheet Functions 2 March 15th 06 04:28 PM
msgbox / inputbox etc samenvoegen van sheets Setting up and Configuration of Excel 1 March 15th 06 03:32 PM


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