Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Excluding NULL values in an Excel List

I have a listbox in an Excel Worksheet. The listbox is at position B1(eg).
The data range for the listbox is from A(1:1000). But all the cells A(1:1000)
may or may not have data. How can i filter the data in my listbox, so that it
does not have any NULL values(blank data).
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excluding NULL values in an Excel List

Use additem in your code to populate the listbox rather than using
ListfillRange. Then only add cells that are not empty.

Dim cell as Range
for each cell in Range("A1:A1000")
if not isempty(cell) then
Activesheet.Listbox1.AddItem Cell.Text
end if
Next

--
Regards,
Tom Ogilvy

"Sheri" wrote in message
...
I have a listbox in an Excel Worksheet. The listbox is at position B1(eg).
The data range for the listbox is from A(1:1000). But all the cells

A(1:1000)
may or may not have data. How can i filter the data in my listbox, so that

it
does not have any NULL values(blank data).



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Excluding NULL values in an Excel List

HI,

that would work if there was only 1 listbox. let me re-phrase my question. i
need an entire column with listboxes say B(1:10000) which loads the data from
Column A(1:1000) without blanks at the end or anywhere in between,
considering that A(1:1000) has blanks in between and at the end.

Regards
Sheri


"Tom Ogilvy" wrote:

Use additem in your code to populate the listbox rather than using
ListfillRange. Then only add cells that are not empty.

Dim cell as Range
for each cell in Range("A1:A1000")
if not isempty(cell) then
Activesheet.Listbox1.AddItem Cell.Text
end if
Next

--
Regards,
Tom Ogilvy

"Sheri" wrote in message
...
I have a listbox in an Excel Worksheet. The listbox is at position B1(eg).
The data range for the listbox is from A(1:1000). But all the cells

A(1:1000)
may or may not have data. How can i filter the data in my listbox, so that

it
does not have any NULL values(blank data).




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excluding NULL values in an Excel List

Let me re-phrase my answer. There is no built in capability to assign a
fixed range (or otherwise) as teh ListFillRange and have the listbox only
display non-blank entries. (regardless of how many listboxes you might have)


As an alternative, if the blanks all occur after the last used cell, then
you could create a dynamic range by doing

Insert=Name=Define

Name: List1
RefersTo: =Offset(Sheet1!$A$1,0,0,CountA(Sheet1!$A$1:$A$1000 ),1)

then in the listfillrange property, use the defined name.

You will have to force a full recalc to refresh the listboxes if you add or
remove date from the range and you should avoid inserting and deleting rows.

--
Regards,
Tom Ogilvy


"Sheri" wrote in message
...
HI,

that would work if there was only 1 listbox. let me re-phrase my question.

i
need an entire column with listboxes say B(1:10000) which loads the data

from
Column A(1:1000) without blanks at the end or anywhere in between,
considering that A(1:1000) has blanks in between and at the end.

Regards
Sheri


"Tom Ogilvy" wrote:

Use additem in your code to populate the listbox rather than using
ListfillRange. Then only add cells that are not empty.

Dim cell as Range
for each cell in Range("A1:A1000")
if not isempty(cell) then
Activesheet.Listbox1.AddItem Cell.Text
end if
Next

--
Regards,
Tom Ogilvy

"Sheri" wrote in message
...
I have a listbox in an Excel Worksheet. The listbox is at position

B1(eg).
The data range for the listbox is from A(1:1000). But all the cells

A(1:1000)
may or may not have data. How can i filter the data in my listbox, so

that
it
does not have any NULL values(blank data).






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find and replace null values in Excel 2002 worksheets? Peter Excel Worksheet Functions 5 October 27th 06 04:53 AM
CSV export from Excel always recognise null values in the last col RichardOKeefe Excel Discussion (Misc queries) 2 April 28th 06 06:56 AM
VB excel Null values !! Please help me !! Aruna Tennakoon Excel Programming 4 April 29th 04 10:13 AM
While reading excel file i am getting null values Aruna Tennakoon Excel Programming 0 April 23rd 04 04:04 AM
While reading excel file i am getting null values Aruna Tennakoon Excel Programming 1 April 22nd 04 12:57 PM


All times are GMT +1. The time now is 01:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"