Is it possible for macro to pause for cell reference?


Posted by Gina H. on March 11, 2001 7:53 PM

Help I am new to macros. Is it possible for macro to pause for input of cell reference and then display it as: "Answer=(row#)+ (row#)"
Example:In Cell(B12) -- "Table=(A6) + (A9)" I would like the end-user to only have to input the cell reference. The macro will not actually be summing anything.
Your attention to this is very appreciated. Gina H.

Posted by Dave Hawley on March 11, 2001 9:36 PM


Hi Gina

If I have understood you, the yes this is possible.

You could use an "InputBox" of Type 8 for this. This will allow you to collect your info via the user to selecting the range, thus elimintating typos.


Sub TryThis()
Dim MyRange As Range


Set MyRange = Application.InputBox _
(Prompt:="Select any range", Title:="DEMO", Type:=8)
On Error Resume Next
If MyRange Is Nothing Then Exit Sub

MsgBox MyRange.Address


End Sub

Dave


OzGrid Business Applications

Posted by Ivan Moala on March 12, 2001 5:20 AM

I think Dave meant to have the On Error Resume next
BEFORE setting the Range variable to the
application.Inputbox

eg
Sub TryThis()
Dim MyRange As Range

On Error Resume Next

Set MyRange = Application.InputBox _
(Prompt:="Select any range", Title:="DEMO", Type:=8)
If MyRange Is Nothing Then Exit Sub

MsgBox MyRange.Address


End Sub

Ivan



Posted by Dave Hawley on March 12, 2001 9:02 PM

Thanks Ivan, I did mean for it to go first.

Dave
OzGrid Business Applications