maraudingjim
New Member
- Joined
- Aug 6, 2021
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
- MacOS
Very new to VBA so bear with me...
Here is what I have.
I'm creating a project where sheet 1 is searchable for specific data based on text. Each line has a checkbox that is linked to a cell on the applicable sheet that the data corresponds to in the workbook. I'd like to be able to populate the ListBox with only the sheets that have been selected via checkbox in worksheet 1 to allow me to quickly print those selected sheets. I attempted to use an If statement that linked linked to the cell in each worksheet that the checkbox changes from TRUE to FALSE, but none of those worked and I either returned all the sheet names or none.
I found in other forums how to populate all of the sheet names and print those selected from the ListBox, but I haven't been able to establish a way to conditionally select the sheets.
Here is the code I'm using.
Private Sub Worksheet_Activate()
Dim Sh
Me.ListBoxSh.Clear
For Each Sh In ThisWorkbook.Sheets
Me.ListBoxSh.AddItem Sh.Name
Next Sh
End Sub
Nothing seems to be working and my last foray into programming happened in 1999 with C++ at college. Any help would be greatly appreciated.
Here is what I have.
I'm creating a project where sheet 1 is searchable for specific data based on text. Each line has a checkbox that is linked to a cell on the applicable sheet that the data corresponds to in the workbook. I'd like to be able to populate the ListBox with only the sheets that have been selected via checkbox in worksheet 1 to allow me to quickly print those selected sheets. I attempted to use an If statement that linked linked to the cell in each worksheet that the checkbox changes from TRUE to FALSE, but none of those worked and I either returned all the sheet names or none.
I found in other forums how to populate all of the sheet names and print those selected from the ListBox, but I haven't been able to establish a way to conditionally select the sheets.
Here is the code I'm using.
Private Sub Worksheet_Activate()
Dim Sh
Me.ListBoxSh.Clear
For Each Sh In ThisWorkbook.Sheets
Me.ListBoxSh.AddItem Sh.Name
Next Sh
End Sub
Nothing seems to be working and my last foray into programming happened in 1999 with C++ at college. Any help would be greatly appreciated.