Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Select a variable range | Excel Worksheet Functions | |||
select cell by variable name | Excel Discussion (Misc queries) | |||
Use a Variable to select a range | Excel Discussion (Misc queries) | |||
add new sheets in a workbook with new sheets being a variable | Excel Discussion (Misc queries) | |||
Select workbook with variable name. | Excel Programming |