LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default ++HELP ME PLEASE++ ComboBoxes as a Variable to Select Sheets

Good Morning,

I'm starting to fumble my way through VB by tinkering and trying new
things with each project I set myself to. I'm currently working on a
detail logging form for competition entry. This is how it needs to
pan out:

Picture this, if you will...

A main sheet, with a "Data Entry Button".

When clicked, this button shows a userform with a few fields; Name,
Entry Name, Ticket Number and Category.

The first three are TextBoxes and work fine, no problems at all. I
can get them to copy into a worksheet and all that. HOWEVER!

The Problem comes when I introduce a separate WorkSheet for each
category. What I have is a ComboBox in the UserForm with the list of
Categories, which are the same as the sheet names. What I want is for
the user to be able to select a category in the ComboBox, and have it
copy the details from the 3 text boxes into the selected category's
sheet.

I assume this is simply a case of finding how to get the text from
within the ComboBox to be the name of the worksheet to select before
copying, however I cannot find out how.

Help on this would be splendid.

Here is the code so-far. The SHEETNAME is where the variable would go
I immagine, but I need to be able to set the Text from the ComboBox as
the source for that sheet name.

===============================================

Private Sub CommandButton66_Click()


Dim LastRow As Object

Set LastRow = SHEETNAME.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
ActiveSheet.Shapes("Picture 1").Select
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 = ""
ComboBox1.Text = ""

TextBox1.SetFocus

Else
Unload Me
End If

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select a variable range Bluecat Excel Worksheet Functions 7 January 13th 09 01:24 AM
select cell by variable name Adam Excel Discussion (Misc queries) 6 May 20th 08 07:54 PM
Use a Variable to select a range Connie Excel Discussion (Misc queries) 3 October 19th 06 05:48 PM
add new sheets in a workbook with new sheets being a variable [email protected] Excel Discussion (Misc queries) 1 April 11th 06 08:38 PM
Select workbook with variable name. FinChase Excel Programming 1 November 12th 04 07:18 PM


All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"