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/ |
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 |
All times are GMT +1. The time now is 09:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com