 
    
    
 
	
	
		
		
	
	
	
	
		
	
	
		
			
- 
	
	
		
		
			
				
				
				
					Solved: Populate ListBox from Worksheet Data
				
					
						
							Hi again,
 
 I was hoping to populate list boxes based on the data entered onto a worksheet.
 
 The code that I was able to retrieve is as follows:
 
 [vba]Private Sub UserForm2_Initialize()
 
 Dim lbtarget As MSForms.ListBox
 Dim rngSource As Range
 
 'Set reference to the range of data to be filled
 Set rngSource = Worksheets("Detail").Range("A7:C13")
 
 'Fill the listbox
 Set lbtarget = Me.ListBox1
 With lbtarget
 'Determine number of columns
 .ColumnCount = 50
 'Set column widths
 .ColumnWidths = "50;80;100"
 'Insert the range of data supplied
 .List = rngSource.Cells.Value
 End With
 
 End Sub [/vba]
 However, the listBox will not populate when I run the code. Can someone help determine where the error lies?
 
 Additionally, the range ("A7:C13") will change over time as a result of rows being added. Is there away to make the range automatically adapt? Will naming the range correct this issue?
 
 As always, thanks for your time!
 
 
 
 
 
 
 
 
	
	
	
	
	
	
	
	
	
	
	
	
		
		
			
				 Posting Permissions
				Posting Permissions
			
			
				
	
		- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-  
Forum Rules