Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code Repeats Itself And Goes To Wrong Focus
Greeting,
For some reason this code repeats itself and then sets the focus on the cancel button. TB2 is a date entry box. LDate2 is a cell that contains the date that is updated in line 2. I change the background color as a visual clue. Private Sub TB2_Exit(ByVal Cancel As MSForms.ReturnBoolean) MsgBox "Start" Range("LDate2").Value = TB2.Value TB2.Text = Format(DateValue(TB2.Text), "mmm dd, yyyy") TB2.BackColor = &H80FFFF EntryFormatLabel.Visible = False BankFrame.Visible = True BankFrame.SetFocus 'The labels, TextBoxes(TBn) and ComboBoxes(CBoxn) are all on this Frame If ESBox1.Text = "Bank Statement" Then MsgBox "Bank Statement" BankNameLabel.Visible = True CBox1.Visible = True BankAccountLabel.Visible = True CBox3.Visible = True BSDepAmountLabel.Visible = True TB3.Visible = True DTDepAmountLabel.Visible = False TB4.Visible = False MsgBox "End Bank Statement" End If If ESBox1.Text = "Non Bank Item" Then MsgBox "Non Bank Item" End If If ESBox1.Text = "Deposit Ticket" Then MsgBox "Deposit Ticket" BankNameLabel.Visible = True CBox1.Visible = True BankAccountLabel.Visible = True CBox3.Visible = True BSDepAmountLabel.Visible = False TB3.Visible = False DTDepAmountLabel.Visible = True TB4.Visible = True MsgBox "End Deposit Ticket" End If End Sub I choose one of three buttons and to change the contents of ESBox1 ("Bank Statement", "Non Bank Item" and "Deposit Ticket"). I put in the MsgBoxes to track the codes progress. That is when I noticed that everything was running twice!!! At the end, I need the focus set to the first tab stop inside the frame. With the way this code is written, the focus goes outside of the frame to the cancel button. Anyone have any ideas as to where I messed up? Any help would be most appreciated. TIA -Minitman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy and paste VBA repeats and repeats | Excel Discussion (Misc queries) | |||
Form keep the focus unable to get to the code - HELP! | New Users to Excel | |||
Opens to form then keep focus and unable to get to code - HELP!! | Excel Discussion (Misc queries) | |||
What is wrong with this code? | Excel Discussion (Misc queries) | |||
Running Code looses focus to Outlook and stops | Excel Programming |