Hide the row inside the TEXTBOX if there is 0

sofas

Active Member
Joined
Sep 11, 2022
Messages
468
Office Version
  1. 2019
Platform
  1. Windows
Hide the row inside the textbox if there is a zero in the second and fourth column



Private Sub ComboBox1_Change()
Me.ComboBox1.Value = Format(Me.ComboBox1.Value, "yyyy/mm/dd")
End Sub

Private Sub ComboBox3_Change()
Me.ComboBox3.Value = Format(Me.ComboBox3.Value, "yyyy/mm/dd")
End Sub

Private Sub CommandButton1_Click()
On Error Resume Next
Dim v As Integer, lr, i
ListBox1.Clear
lr = Sheets("DATA").Cells(Sheets("DATA").Rows.Count, "A").End(xlUp).Row
For i = 2 To lr
If Sheets("DATA").Cells(i, 1).Offset(0, 0) >= CDate(ComboBox1.Text) Then
If Sheets("DATA").Cells(i, 1).Offset(0, 1) = ComboBox2.Text Then

If Sheets("DATA").Cells(i, 1).Offset(0, 0) <= CDate(ComboBox3.Text) Then
ListBox1.AddItem Sheets("DATA").Cells(i, 1).Value
ListBox1.List(v, 1) = Format(Sheets("DATA").Cells(i, 0).Offset(0, 0).Value, "YYYY/MM/DD")
ListBox1.List(v, 2) = Sheets("DATA").Cells(i, 1).Offset(0, 1).Value
ListBox1.List(v, 3) = Sheets("DATA").Cells(i, 1).Offset(0, 2).Value

ListBox1.List(v, 5) = Sheets("DATA").Cells(i, 1).Offset(0, 4).Value

v = v + 1
End If
End If
End If
Next
End Sub



Private Sub UserForm_Initialize()
ListBox1.ColumnCount = 7

End Sub
[/CODE]
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top