View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Adeptus - ExcelForums.com Adeptus - ExcelForums.com is offline
external usenet poster
 
Posts: 18
Default ++HELP ME PLEASE++ ComboBoxes as a Variable to Select Sh

OK, well it worked a treat... turns out that I was trying to call the
actual sheet names (The one at the top of the properties box in VB)
and not the Name on the Tab! SO when I tried that it's working
perfectly.

However now I have an interesting thing pop up,

When I run through the steps, if I select NOT to print and go straight
to entering a new entry, it has an error that says it cannot set focus
on the textbox1.

Runtime error 2110, can't move focus to the control because it is
invisible, not enabled, or of a type that does not accept focus.
Then it highlights the setfocus line. What's going on there?

following is the code:


Private Sub CommandButton66_Click()

Dim LastRow As Object
ShtName = ComboBox66.Text

Sheets(ShtName).Select

Set LastRow = Range("A400").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text
LastRow.Offset(1, 2).Value = TextBox3.Text

MsgBox "Entry successfully written to Data Table"

response = MsgBox("Do you want to print the Entry
Certificate now?", vbYesNo)

If response = vbYes Then
Range("A" & Range("E3"),
"C" & Range("E3")).Select
Selection.Copy
Sheets("Printout").Select
Range("M12").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=True
Range("A1").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
Sheets("U14 Single").Select
Range("A5").Select

MsgBox "Entry successfully printed!"

Else
Unload Me
End If

response = MsgBox("Do you want to input another
Entry?", _
vbYesNo)

If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""

TextBox1.SetFocus

Else
Unload Me
End If

End Sub
[/code]