Pause code with modeless form

Jeff H
4StarLounger
Posts: 415
Joined: 31 Oct 2017, 20:07

Pause code with modeless form

Post by Jeff H »

In Excel 365 I have a macro that collects selected data from a worksheet laid out horizontally. The collected data is displayed in a userform with the highlighted record behind it. I want to be able to scroll the worksheet horizontally to review the data in the userform. But when I set the userform to modeless, the code continues to process. Is there a way to pause the code until I close the userform and still be able to scroll the worksheet?

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Pause code with modeless form

Post by HansV »

One option would be to place command buttons on the userform that scroll the sheet to the left and right.
Another one would be to use

Code: Select all

    Application.InputBox Prompt:="Scroll as you like, click Cancel when done", Type:=8
Best wishes,
Hans

Jeff H
4StarLounger
Posts: 415
Joined: 31 Oct 2017, 20:07

Re: Pause code with modeless form

Post by Jeff H »

Beautiful!! I tried the Inputbox first and it works great. I'll try the scroll buttons later. Both solutions are really good.

Thanks Hans.

- Jeff

Jeff H
4StarLounger
Posts: 415
Joined: 31 Oct 2017, 20:07

Re: Pause code with modeless form

Post by Jeff H »

And I just tried the buttons with LargeScroll. That one is even better. As always, thanks very much.