ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Code Help (https://www.excelbanter.com/excel-programming/371361-vba-code-help.html)

TimN

VBA Code Help
 
I have a user form that contains a check box. When the check Box Yes
selection is made, a MsgBox appears providing the user some information.

Is it possible upon the "OK" being clicked in that message box to take the
user to a defined cell? My MsgBox is telling the user they need to enter
data in, say cell B1. I would like to have cell B1 be the active cell after
the OK is clicked in the MsgBox.

Any ideas?

Thanks!

Jim Thomlinson

VBA Code Help
 
You bet... The only trick is that your form can not be Modal. Change the
ShowModal property of the form to false (or when you show the form
Userform1.Show False). Now you can get off of the form and onto the sheet.

msgbox "Some Description", vbOkOnly
with sheets("Sheet1")
.Select
.Range("A1").Select
end with

The form will still be shown throughout this process...
--
HTH...

Jim Thomlinson


"TimN" wrote:

I have a user form that contains a check box. When the check Box Yes
selection is made, a MsgBox appears providing the user some information.

Is it possible upon the "OK" being clicked in that message box to take the
user to a defined cell? My MsgBox is telling the user they need to enter
data in, say cell B1. I would like to have cell B1 be the active cell after
the OK is clicked in the MsgBox.

Any ideas?

Thanks!


TimN

VBA Code Help
 
Thanks Jim. That is exactly what I was after!

"Jim Thomlinson" wrote:

You bet... The only trick is that your form can not be Modal. Change the
ShowModal property of the form to false (or when you show the form
Userform1.Show False). Now you can get off of the form and onto the sheet.

msgbox "Some Description", vbOkOnly
with sheets("Sheet1")
.Select
.Range("A1").Select
end with

The form will still be shown throughout this process...
--
HTH...

Jim Thomlinson


"TimN" wrote:

I have a user form that contains a check box. When the check Box Yes
selection is made, a MsgBox appears providing the user some information.

Is it possible upon the "OK" being clicked in that message box to take the
user to a defined cell? My MsgBox is telling the user they need to enter
data in, say cell B1. I would like to have cell B1 be the active cell after
the OK is clicked in the MsgBox.

Any ideas?

Thanks!



All times are GMT +1. The time now is 09:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com