Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Details from ListBox onto a NewWorkbook
I have the following code to enter the values into a workbook. ListBox1
works well (cause there will always only be one reference). But I'm having trouble with LB2: Private Sub cmd_Create_SignINsheet_Click() 'Dim WB As Mowrkbook, WS As Worksheet 'Set WB = Windows("BLANK Sign in Sheet.xls").Activate 'Set WS = Sheets("Sign-In Sheet").Select 'Dim NewRow As Long Dim index As Integer Windows("BLANK Sign in Sheet.xls").Activate Sheets("Sign-In Sheet").Select Range("c7,c9,k9,s9,c11,k11,s11,c12,e12,g12,k12,c13 ,e13,g13,k13,c14,e14,g14,c17:c32,k17:k32").ClearCo ntents Range("C17").Cells(1).Value = TextBox1.Value With ListBox2 For index = 0 To .ListCount - 1 If .Selected(index) Then Range("k17").Cells(1).Value = ListBox2.Value ' NewRow = NewRow + 1 ' WS.Cells(NewRow, 1).Value = .List(Index) End If Next End With End Sub What I'm trying to do is what ever is selected in ListBox2 is then entered into Range k17 down to k32. Anyone have any ideas on this. --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Details from ListBox onto a NewWorkbook
Hi sjvenz,
Code ------------------- Private Sub cmd_Create_SignINsheet_Click() 'Dim WB As Mowrkbook, WS As Worksheet 'Set WB = Windows("BLANK Sign in Sheet.xls").Activate 'Set WS = Sheets("Sign-In Sheet").Select Dim NewRow As Long Dim index As Integer Windows("BLANK Sign in Sheet.xls").Activate Sheets("Sign-In Sheet").Select Range("c7,c9,k9,s9,c11,k11,s11,c12,e12,g12,k12,c13 ,e13,g13,k13,c14,e14,g14,c17:c32,k17:k32").ClearCo ntents Range("C17").Cells(1).Value = TextBox1.Value With ListBox2 For index = 0 To .ListCount - 1 If .Selected(index) Then Range("k17").Offset(NewRow).Value = ListBox2.List(index) NewRow = NewRow + 1 End If Next End With End Sub ------------------- -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to update a "master" spreadsheet every time I create a newworkbook or a new sheet | Excel Worksheet Functions | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming | |||
Excel NewWorkbook event | Excel Programming | |||
C# newWorkbook event | Excel Programming |