Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with VB script please?
Hi,
I'm having a little trouble with the following VB. What it's meant to do is to load the contents of a text box and two combo boxes into particular cells in a spreadsheet - This bit is OK. However, it is also meant to copy the same data into three celss on a different worksheet (one that is created when the form used is launched), but what it does is copy the contents of the text box into all three cells, ignoring what is in the combo boxes. Obviously something wrong with my VB script, but cannot see exactly what. Any suggestions would be much appreciated. Private Sub CommandButton1_Click() Dim rng As Range Set rng = Cells(Rows.Count, "A").End(xlUp)(2) rng.Value = TextBox1 Selection.copy Sheets("Form master (2)").Select Range("B3").Select Selection.PasteSpecial Paste:=xlValues Sheets("Main").Select Sheets("Main").Select Set rng = Cells(Rows.Count, "B").End(xlUp)(2) rng.Value = ComboBox1 Selection.copy Sheets("Form master (2)").Select Range("B7").Select Selection.PasteSpecial Paste:=xlValues Sheets("Main").Select Set rng = Cells(Rows.Count, "C").End(xlUp)(2) rng.Value = ComboBox2 Selection.copy Sheets("Form master (2)").Select Range("B11").Select Selection.PasteSpecial Paste:=xlValues Sheets("Form master (2)").Select Sheets("Form master (2)").Name = (TextBox1.Text) -- Cheers Peter Remove the INVALID to reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
help with vba script | New Users to Excel | |||
Help ! How do I do this in VB Script | Setting up and Configuration of Excel | |||
I need some VB script please | Excel Discussion (Misc queries) | |||
VB script help - please!! | Excel Discussion (Misc queries) | |||
Excel 2000/XP script to Excel97 script | Excel Programming |