I think the tl;dr would be, how can I have Excel prompt me to take some action and then wait until I've completed the action?
I'm writing a subroutine to re-sort columns in a table. I would like to be able to set it up such that the user (me) starts the macro and is prompted to click on a cell in the Source column, and then click on a cell in the Destination column, and then the subroutine moves the Source to the left of the Destination column.
I can move the columns around just fine. What I don't know how to do is start a macro and have a message box pop up and tell the user to select a cell. The message box always takes over control of the GUI such that I can't click in Excel anywhere. After reading the documentation at MS I tried this, knowing better, and as I suspected changing the modality of the message box didn't allow me to select a cell in Excel:
Looking at the docs for an InputBox, seems like that wouldn't work either.
Thanks!!
Matt
I'm writing a subroutine to re-sort columns in a table. I would like to be able to set it up such that the user (me) starts the macro and is prompted to click on a cell in the Source column, and then click on a cell in the Destination column, and then the subroutine moves the Source to the left of the Destination column.
I can move the columns around just fine. What I don't know how to do is start a macro and have a message box pop up and tell the user to select a cell. The message box always takes over control of the GUI such that I can't click in Excel anywhere. After reading the documentation at MS I tried this, knowing better, and as I suspected changing the modality of the message box didn't allow me to select a cell in Excel:
Code:
Sub TestModal()
MsgBox "Message box vbApplicaitonModal", vbOKOnly + vbApplicationModal
MsgBox "Message box vbSystemModal", vbOKOnly + vbSystemModal
End Sub
Looking at the docs for an InputBox, seems like that wouldn't work either.
Thanks!!
Matt