Ottsel
Board Regular
- Joined
- Jun 4, 2022
- Messages
- 167
- Office Version
- 365
- Platform
- Windows
Hi everyone,
Attempting to have my down-drop list show dates that are currently not hidden, but only dates that have data within them. Each week a new line is entered and that new date is populated, but having to start from the VERY beginning can be a hassle - even more so, since you can't wheel the menu and have to drag it.
Start of list: Hidden rows + 15, since the data begins on row 15.
End of list: Taking not blank rows - Hidden rows - blank rows will give me the point of where the list should end
Currently rows 15-692 are hidden and the date within C693 is 01/03/20.
The last row is 819 with the date 06/03/22. 06/10/22 will be the next input, but there's no reason to list it until data is entered into D820.
Not sure if its possible, but if there is a way to use your mouse wheel instead of having to drag it I'd love to read up on how to implement that into this and possible future drop-down userform menus.
With that said: I've taken my amateur VBA knowledge (which is ranking it too high in my opinion) and done the following:
Attempting to have my down-drop list show dates that are currently not hidden, but only dates that have data within them. Each week a new line is entered and that new date is populated, but having to start from the VERY beginning can be a hassle - even more so, since you can't wheel the menu and have to drag it.
Start of list: Hidden rows + 15, since the data begins on row 15.
End of list: Taking not blank rows - Hidden rows - blank rows will give me the point of where the list should end
Currently rows 15-692 are hidden and the date within C693 is 01/03/20.
The last row is 819 with the date 06/03/22. 06/10/22 will be the next input, but there's no reason to list it until data is entered into D820.
Not sure if its possible, but if there is a way to use your mouse wheel instead of having to drag it I'd love to read up on how to implement that into this and possible future drop-down userform menus.
With that said: I've taken my amateur VBA knowledge (which is ranking it too high in my opinion) and done the following:
VBA Code:
Sub DropDownCombo1()
Dim ws As Worksheet
Dim rHidden, x As Long
Dim rng As Range
Dim rBlank, nBlank As Integer
Dim bStart(), bEnd() As Integer
'Obtain # of hidden rows
Set ws = Sheets("Current")
rHidden = 0
For x = 1 To ws.Range("c14").CurrentRegion.Rows.Count
If ws.Cells(x, 1).EntireRow.Hidden = True Then
rHidden = rHidden + 1
End If
Next x
'Obtain # of rows blank from D14:D1085
rBlank = Application.WorksheetFunction.CountBlank(ws.Range("D14:D1085"))
'Obtain # of rows NOT blank from D14:1085
nBlank = Worksheets("Current").Range("C15:C1085").Cells.SpecialCells(xlCellTypeConstants).Count
'now to pull it all together... somehow
ReDim bStart(rHidden + 15)
ReDim bEnd(nBlank - rHidden - rBlank)
UserForm.ComboBox1.AddItem
End Sub