Checkbox with condition after condition

ping0775

New Member
Joined
Jul 18, 2022
Messages
40
Office Version
  1. 2007
Platform
  1. Windows
Private Sub ShowAllInvoiceCheckBox_click()
On Error Resume Next

Dim i As Long
If ShowAllInvoiceCheckBox.Value = True Then
Me.InvLabel1 = Format(StrConv(Me.InvLabel1, vbLowerCase))
Me.ListView1.ListItems.Clear
For i = 3 To Sheet4.Range("a1000000").End(xlUp).Row
For x = 1 To Len(Sheet4.Cells(i, 5))
a = Me.InvLabel1.TextLength
If LCase(Mid(Sheet4.Cells(i, 5), x, a)) = Me.InvLabel1 And Me.InvLabel1 <> "" Then


Set Itm = Me.ListView1.ListItems.Add(Text:=Sheet4.Cells(i, "A")) 'sl
Itm.SubItems(1) = Sheet4.Cells(i, "B") 'inv no
Itm.SubItems(2) = Format(Sheet4.Cells(i, "C"), "dd-MM-yy") 'date
Itm.SubItems(3) = Sheet4.Cells(i, "E") 'billing
Itm.SubItems(4) = Sheet4.Cells(i, "X") 'term
Itm.SubItems(5) = Format(Sheet4.Cells(i, "W"), "####0.00") 'orig Amt
Itm.SubItems(6) = Format(Sheet4.Cells(i, "DN"), "####0.00") 'outstanding
Itm.SubItems(7) = Format(Sheet4.Cells(i, "DO"), "####0.00") 'Paid


If Sheet4.Cells(i, "DN").Value >= 0.01 Then
For n = 1 To 7
Itm.ForeColor = vbRed
Itm.ListSubItems(n).ForeColor = vbRed
Next x
Next i
Next n
the condition above i had extract InvLabel1 Textbox all data from invoicelist.
but the problem is i need add a condition in the "if and then" after the first "if and then" condition run


1st condition listview will appear all the data from InvLabel1
If LCase(Mid(Sheet4.Cells(i, 5), x, a)) = Me.InvLabel1 And Me.InvLabel1 <> "" Then


2nd condition i need to sort out with color from condition 1 with code below
If Sheet4.Cells(i, "DN").Value >= 0.01 Then For n = 1 To 7
Itm.ForeColor = vbRed
Itm.ListSubItems(n).ForeColor = vbRed
Next x

how to place in the upper vba code? attempt many times but wasn't success
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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