Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Skipping blank cells in a column...

I have a column where some data is dumped. Sometimes there is a blank cell in
a column. I want to add the values to the listbox from only those cells where
there is a data. If there is no data i need to skip the cell.

I am using the following code...which works fine if there are no blanks in
between or start ....but it doesn't work fine for where there are blank in
between or start

Suggestions will be highly appreciated.

Set TestSheet = ThisWorkbook.Sheets("Test")

TopicCount = Application.WorksheetFunction.CountA(TestSheet.Ran ge("3:3"))
For Col = 2 To TopicCount + 1
lstbox1.AddItem TestSheet.Cells(3, Col)
Next Col
lstbox1.ListIndex = 0

--
Ajit
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Skipping blank cells in a column...

Dim rng as Range, Testsheet as Worksheet
Set TestSheet = ThisWorkbook.Sheets("Test")
With TestSheet
set rng = .Range(.Cells(3,1),.Cells(3,256).End(xltoLeft))
End With
For each cell in rng
if not isempty(cell) then
lstbox1.AddItem cell.Value
Next
lstbox1.ListIndex = 0

--
Regards,
Tom Ogilvy

"Ajit" wrote in message
...
I have a column where some data is dumped. Sometimes there is a blank cell

in
a column. I want to add the values to the listbox from only those cells

where
there is a data. If there is no data i need to skip the cell.

I am using the following code...which works fine if there are no blanks in
between or start ....but it doesn't work fine for where there are blank in
between or start

Suggestions will be highly appreciated.

Set TestSheet = ThisWorkbook.Sheets("Test")

TopicCount =

Application.WorksheetFunction.CountA(TestSheet.Ran ge("3:3"))
For Col = 2 To TopicCount + 1
lstbox1.AddItem TestSheet.Cells(3, Col)
Next Col
lstbox1.ListIndex = 0

--
Ajit



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
skipping blank cells in dynamic chart Ravens Fan Charts and Charting in Excel 4 January 9th 08 05:24 PM
Skipping blank cells when calculating time difference GARDNERGUY Excel Discussion (Misc queries) 3 April 20th 07 06:28 PM
Concatenation and skipping blank cells soma104 Excel Worksheet Functions 6 May 31st 06 01:12 PM
Skipping Blank Cells Coltsfan Excel Discussion (Misc queries) 1 October 13th 05 01:23 AM
Skipping Blank Or Null Cells In a Lookup Function Bill Johnson Excel Worksheet Functions 8 December 24th 04 01:06 AM


All times are GMT +1. The time now is 07:55 PM.

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

About Us

"It's about Microsoft Excel"