View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
George George is offline
external usenet poster
 
Posts: 62
Default message box popping up when the selection of a Form combo box

Hi, OssieMac:

Mr. Merjet wrote me a very short code which is almost perfect except
one problem. The code is as follows:

Sub DropDown1_Change()
Static iPrev As Integer
Dim iRtn As Integer
iRtn = MsgBox("Are you sure you want to switch the option?",
vbYesNo)
If iRtn = vbNo Then 'C4 is linked cell
ActiveSheet.Range("C4") = iPrev
Else
iPrev = ActiveSheet.Range("C4")
End If
End Sub


Here is the problem. I saved my excel file and closed up. When I re-
open it, click the combo box and click another option other than the
current one, a message comes up asking me "Are you sure you want to
switch the option?". If I click "No", the combo box will be blank as
it is not supposed to be because I want nothing to be changed whenever
I click "No" as a response to the message.

Do you have any ideas how to fix this? This code is really neat!

Thank you so much and I look forward to hearing from you soon!