PDA

View Full Version : Solved: Listbox Related Question



akshay2007
04-22-2010, 02:24 AM
Hello....I am a new member to this forum & also to visual basic for applications.

I was trying the code for sorting the listbox items numerically as well as alphabetically.

I tried the example from help menu to load the listbox and used a sortlistbox function that I found over the net.

I am getting the items sorted but I am getting them shifted by one place downwards.

For example if ListItem (0,0) is "zero" & ListItem (1,0) = "one", the situation before & after sorting is as follows:

BEFORE SORTING

row 0 zero
row 1 one

AFTER SORTING

row 0 EMPTY
row 1 one
row 2 zero

I need the values arranged as per alphabets but the places should not be changed.

I need help for understanding & resolving the problem...I had attached a sample worksheet herewith.

Thanks much!!

Akshay

arangogs
04-22-2010, 04:07 AM
Hi Akshay,

I think this is what you are looking for, change your array declaration to

Dim myArray(5,3)

akshay2007
04-22-2010, 04:56 AM
Hi arangogs,

Thanks for your reply...I tried changing the array declaration & it worked!

-- Akshay.

mdmackillop
04-22-2010, 05:39 AM
Hi Akshay,

I think this is what you are looking for, change your array declaration to

Dim myArray(5,3)

Or maybe even (5,2)? :yes

Akshay,
Welcome to VBAX,
You can mark your thread Solved using the Thread Tools dropdown.
Regards
MD

arangogs
04-22-2010, 06:13 AM
yeah, missed that there, mate :thumb