VBA Problem

Lochnagar

New Member
Joined
Jan 28, 2008
Messages
43
Hi,

I have another VBA problem that I was hoping someone might be able to help out with. Basically, I need to stop the macros that I've written mid-way and prompt the user to select the next cell that the macros is to continue from. I appreciate that I could just use Activecell.offset(...), but the position of the cell that I want it to offset to is not fixed i.e. its user specified. I've tried using a Msgbox, which does stop the macros, but won't let me click on the spreadsheet.

Any help/suggestions would be very much appreciated

Thanks in advance,

Lochnagar
 

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,454
Sub Test()
Dim MyRange As Range
Set MyRange = Application.InputBox("Select a range.", "Range Input", Type:=8)
MyRange.Select
End Sub
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,651
Similar to Jim's but with an error check (in case user clicks Cancel for example).

Code:
Sub SelCell()
Dim r As Range
On Error Resume Next
Set r = Application.InputBox("Click in the next cell", Type:=8)
On Error GoTo 0
If r Is Nothing Then Exit Sub
Application.Goto reference:=r
End Sub
 

Lochnagar

New Member
Joined
Jan 28, 2008
Messages
43
Awesome, thanks VoGII and jim may, that was bang on what I was after. Brilliant thanks again.

Lochnagar.
 

Forum statistics

Threads
1,082,570
Messages
5,366,364
Members
400,886
Latest member
Fchel

Some videos you may like

This Week's Hot Topics

Top