actaully i have problem in this code he ask me define a variable but i copy this the same code from websites and it doesn't define avariable and works but me it doesn't
any body can help me, please
Private Sub CommandButton1_Click()
Dim i, a, j, x, h As Long
Me.ListBox1.Clear
'for column header
Me.ListBox1.AddItem
For a = 1 To 5
Me.ListBox1.List(0, a - 1) = ورقة1.Cells(1, a)
Next a
Me.ListBox1.Selected(0) = True
'for listbox fill
For i = 2 To ورقة1.Range("a100000").End(xlUp).Offset(1, 0).Row
For j = 1 To 5
h = Application.WorksheetFunction.CountIf(ورقة1.Range("a" & 2, "e" & i), -ورقة1.Cells(i, j))
If h = 1 And LCase(ورقة1.Cells(i, j)) = LCase(Me.TextBox1) Or h = 1 And -ورقة1.Cells(i, j) = Val(Me.TextBox1) Then
Me.ListBox1.AddItem
For x = 1 To 5
Me.ListBox1.List(ListBox1.ListCount - 1, x - 1) = ورقة1.Cells(i, x)
Next x
End If
Next j
Next i
End Sub
any body can help me, please
Private Sub CommandButton1_Click()
Dim i, a, j, x, h As Long
Me.ListBox1.Clear
'for column header
Me.ListBox1.AddItem
For a = 1 To 5
Me.ListBox1.List(0, a - 1) = ورقة1.Cells(1, a)
Next a
Me.ListBox1.Selected(0) = True
'for listbox fill
For i = 2 To ورقة1.Range("a100000").End(xlUp).Offset(1, 0).Row
For j = 1 To 5
h = Application.WorksheetFunction.CountIf(ورقة1.Range("a" & 2, "e" & i), -ورقة1.Cells(i, j))
If h = 1 And LCase(ورقة1.Cells(i, j)) = LCase(Me.TextBox1) Or h = 1 And -ورقة1.Cells(i, j) = Val(Me.TextBox1) Then
Me.ListBox1.AddItem
For x = 1 To 5
Me.ListBox1.List(ListBox1.ListCount - 1, x - 1) = ورقة1.Cells(i, x)
Next x
End If
Next j
Next i
End Sub