Why my selection is lost with MsgBox?
I agree. Below is my experiment. It stays highlighted until I send the right
cursor keystroke whether I delete the row or not. Watch that you are not
unintentionally releasing the selection somehow.
Roy
Dim x As Integer
Rows(7).Select
x = MsgBox("Really delete this row? Press OK to delete or Cancel to abort.",
vbOKCancel + vbExclamation, "Delete Row?")
If x = vbOK Then
Rows(7).Delete
End If
SendKeys "{RIGHT}" 'to relase the selection
--
(delete .nospam)
"Tim Williams" wrote:
Get a reference to the selection before you pop up the messagebox.
dim rngSel as range
set rngSel = selection
'do stuff which might change selection
'operate on rngSel
However, msgbox doesn't change the selection for me, so maybe you're
doing something else in your code?
Tim
"MLevesque" wrote in message
...
I have a rows selection to delete, and using a msgbox I want to ask
user to
do ok or cancel, but when the msgbox is popup, my rows selection is
lost :o(
How could I avoid that problem? Thank you!
|