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: 60
Default 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
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
help with vba script lariveesl New Users to Excel 5 June 6th 09 08:53 AM
Help ! How do I do this in VB Script Sean Setting up and Configuration of Excel 3 March 17th 08 12:16 PM
I need some VB script please rlee1999 Excel Discussion (Misc queries) 2 October 25th 06 05:46 PM
VB script help - please!! Anthony Excel Discussion (Misc queries) 1 July 13th 05 01:19 AM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM


All times are GMT +1. The time now is 11:49 AM.

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

About Us

"It's about Microsoft Excel"