Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
skipping blank cells in dynamic chart | Charts and Charting in Excel | |||
Skipping blank cells when calculating time difference | Excel Discussion (Misc queries) | |||
Concatenation and skipping blank cells | Excel Worksheet Functions | |||
Skipping Blank Cells | Excel Discussion (Misc queries) | |||
Skipping Blank Or Null Cells In a Lookup Function | Excel Worksheet Functions |