-
[RESOLVED] List box
Hello, i have problem , when ever i try to add info from cells to list box it also adds empty spaces, how could i change this?
Here is my code
Code:
Private Sub CommandButton1_Click()
ListBox1.Clear
If TypeOf Selection Is Range Then
For i = 1 To Selection.Rows.Count
For j = 1 To Selection.Columns.Count
ListBox1.AddItem (Selection.Cells(i, j))
Next
Next
End If
End Sub
-
Re: List box
Are you sure that this is VB.NET? Looks more like VB6 or maybe VBA.
-
Re: List box
Im not sure i know the difference. what forum would you suggest me?
-
Re: List box
I would suggest that you work out what language you're actually using and then post in the forum dedicated to that language.
-
Re: List box
What software application are you using to develop the code?
-
Re: List box
-
Re: List box
Moved to office development which is for VBA questions.
-
Re: List box
try like
Code:
if not isempty(selection.celss(i, j)) then ListBox1.AddItem (Selection.Cells(i, j))
-
Re: List box
Okey, tnx, but how could i integrete in my code?
Do i make another ''if'' or i add it with ''and'' to the first one?
-
Re: List box
just swap it in place of the existing line to additems