GoTo Help...

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I am moving all over a worksheet via Range
("cell").select, I now come to a decision tree.

Range("A19").Select
Answer = InputBox("Continue? Enter: Y or
N ?", "Answer", "", 1, 1)
ActiveCell.Value = Answer

If the user enters "Y", I want to proceed to A40
If the user enters "N" I want to proceed to A50

What is the best way to handle this?


Thanks,

Dave
 
Dave,

Range("A19").Select
Answer = MsgBox("Continue?", vbYesNo, "Answer")
If Answer = vbYes Then
ActiveCell.Value = "Y"
Range("A40").Select
Else
ActiveCell.Value = "N"
Range("A50").Select
End If

Though you really don't need to select a cell to change its value.

HTH,
Bernie
MS Excel MVP
 
Bernie,

Thank you!

As usual, I kept looking at it backwards.
This works great.

Thanks again.

Dave
 
try this.
But if you are going to do the same thing in the next selected cell, don't.
Selections are almost never necessary.

Sub wheretogo()
Range("a19") = InputBox("Continue? Enter: Y or N ?", "Answer", "", 1, 1)
If UCase(Range("a19")) = "Y" Then Application.Goto Range("a40")
If UCase(Range("a19")) = "N" Then Application.Goto Range("a50")
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top