PDA

View Full Version : Help with VBA code for single selection listbox



vcrlu
08-15-2010, 09:42 AM
I am new to the VBA world. I have a workbook that has several worksheets (e.g. A, B, C, D, E...). I have created a userform. I want to create a single-item list box. Based on what spreadsheet is selected in the listbox I want the VBA code that will activate that spreadsheet and transfer entries from the userform into that activated spreadsheet.

Thanking you in advance.

Bob Phillips
08-15-2010, 09:45 AM
With Worksheets(Me.LisBox1.Value)

.Range("A1").Value = Me.TextBox1.Text
.Range("A2").Value = Me.TextBox2.Text
'etc
End With

vcrlu
08-16-2010, 04:16 PM
Thank you.

I however need little more than that. I want the code that makes active the right worksheet based on the single selection listbox on the userform and then transfer the text info from the userform to the activated spreadsheet. Thanking you in advance

Bob Phillips
08-17-2010, 12:50 AM
There is absolutely no need to make it active, you can transfer the data without making it active, as I show.