Hi I have a problem with my code, and it would be great if you can help
It is looping, but only recording the result of the final loop in the list box. My code is below, Is there any reason it is not adding multiple items to the list box, each on a new line? It is just overwriting the same element over and over.
Thanks!
Do While AssetYN.Text = "Y"
If Search.Text = oSheet.Range("N" & Increment.Text).value Then
Form4.ListBox1.Items.Add(oSheet.Range("B" & Increment.Text).value)
Form4.Show()
Form4.CityForm4.Text = Search.Text
Form4.Form4loading.Visible = True
Form4.Form4Increment.Text = Increment.Text
'X = X + 1
Exit Do
Else
If Search.Text <> oSheet.Range("N" & Increment.Text).value Then
End If
End If
Increment.Text = Increment.Text + 1
Loop
It is looping, but only recording the result of the final loop in the list box. My code is below, Is there any reason it is not adding multiple items to the list box, each on a new line? It is just overwriting the same element over and over.
Thanks!
Do While AssetYN.Text = "Y"
If Search.Text = oSheet.Range("N" & Increment.Text).value Then
Form4.ListBox1.Items.Add(oSheet.Range("B" & Increment.Text).value)
Form4.Show()
Form4.CityForm4.Text = Search.Text
Form4.Form4loading.Visible = True
Form4.Form4Increment.Text = Increment.Text
'X = X + 1
Exit Do
Else
If Search.Text <> oSheet.Range("N" & Increment.Text).value Then
End If
End If
Increment.Text = Increment.Text + 1
Loop