Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
How to update a "master" spreadsheet every time I create a newworkbook or a new sheet [email protected] Excel Worksheet Functions 3 December 27th 07 09:04 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM
Excel NewWorkbook event Doug Paul Excel Programming 0 September 4th 03 02:47 PM
C# newWorkbook event Doug Paul Excel Programming 0 August 27th 03 04:39 PM


All times are GMT +1. The time now is 12:24 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"