Hello,
I have a form with a listbox which is populated with the names of sheets in my workbook. I want to have 2 columns, the first is the sheet name and the second will be the value of a cell on that sheet. This is the code I currently have:
This doesn't work because the sheet name and the cell contents are showing on different lines on the list in teh first column. Is it possible for me to get the sheet name in the first and the cell contents in the second column?
thanks
I have a form with a listbox which is populated with the names of sheets in my workbook. I want to have 2 columns, the first is the sheet name and the second will be the value of a cell on that sheet. This is the code I currently have:
Code:
Private Sub UserForm_Initialize()
Dim wbs As Worksheet
For Each wbs In Worksheets
If wbs.Name <> "Contents" Then
If wbs.Name <> "Status" Then
If wbs.Name <> "Introduction" Then
If wbs.Name <> "Template" Then
If wbs.Range("G10") > 0 Then
ListBox1.ColumnCount = 2
ListBox1.AddItem wbs.Name, 0
ListBox1.AddItem wbs.Range("D4"), 1
End If
End If
End If
End If
End If
Next
End Sub
This doesn't work because the sheet name and the cell contents are showing on different lines on the list in teh first column. Is it possible for me to get the sheet name in the first and the cell contents in the second column?
thanks