Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Reading Row headers into a listbox

I have got this to work with TAB names follwing the help in Excel, however, I
want to read in row headers into a listbox and I can't get it to work.

While worksheets(1).cells(1,col).value < ""
listbox1.additem worksheets(1).cells(1,col).value
col=col+1
Wend

Any ideas

Many thanks
--
Steve R
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Reading Row headers into a listbox

did you initialize col

col = 1
While worksheets(1).cells(1,col).value < ""
listbox1.additem worksheets(1).cells(1,col).value
col=col+1
Wend

--
regards,
Tom Ogilvy


"Steve" wrote:

I have got this to work with TAB names follwing the help in Excel, however, I
want to read in row headers into a listbox and I can't get it to work.

While worksheets(1).cells(1,col).value < ""
listbox1.additem worksheets(1).cells(1,col).value
col=col+1
Wend

Any ideas

Many thanks
--
Steve R

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Reading Row headers into a listbox

I have used the Dim Col as Integer.

Is this what you mean?
--
Steve R


"Steve" wrote:

I have got this to work with TAB names follwing the help in Excel, however, I
want to read in row headers into a listbox and I can't get it to work.

While worksheets(1).cells(1,col).value < ""
listbox1.additem worksheets(1).cells(1,col).value
col=col+1
Wend

Any ideas

Many thanks
--
Steve R

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Reading Row headers into a listbox

Tom's saying that you need to initialize the value of col to 1 before you
enter the while loop.

"Steve" wrote:

I have used the Dim Col as Integer.

Is this what you mean?
--
Steve R


"Steve" wrote:

I have got this to work with TAB names follwing the help in Excel, however, I
want to read in row headers into a listbox and I can't get it to work.

While worksheets(1).cells(1,col).value < ""
listbox1.additem worksheets(1).cells(1,col).value
col=col+1
Wend

Any ideas

Many thanks
--
Steve R

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Reading Row headers into a listbox


Steve,

Just to add to Paul's comment,

I added a line

col = 1

certainly
Dim col as Integer
is useful, but whether you do that or not, the default effect is that col
has a value of zero when you first try to use it and

Cells(1,0) is illegal - there is no Cells(1,0)

so setting col = 1 (or whichever column number you want to start with) as
the first executable command will give it a proper/legal value (for use with
Cells)

--
Regards,
Tom Ogilvy

"Steve" wrote:

I have used the Dim Col as Integer.

Is this what you mean?
--
Steve R


"Steve" wrote:

I have got this to work with TAB names follwing the help in Excel, however, I
want to read in row headers into a listbox and I can't get it to work.

While worksheets(1).cells(1,col).value < ""
listbox1.additem worksheets(1).cells(1,col).value
col=col+1
Wend

Any ideas

Many thanks
--
Steve R



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Reading Row headers into a listbox

Sorry

Yes, I have done that.
--
Steve R


"Steve" wrote:

I have got this to work with TAB names follwing the help in Excel, however, I
want to read in row headers into a listbox and I can't get it to work.

While worksheets(1).cells(1,col).value < ""
listbox1.additem worksheets(1).cells(1,col).value
col=col+1
Wend

Any ideas

Many thanks
--
Steve R

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
lookup using column headers and row headers Memphus01 Excel Discussion (Misc queries) 1 April 13th 09 04:57 PM
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) modjoe23 Excel Programming 3 August 18th 05 02:35 PM
Adding and Reading a ListBox Item Geoff Excel Programming 1 May 29th 05 12:39 AM
Populating Column Headers in a ListBox KL[_4_] Excel Programming 4 September 1st 04 12:55 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM


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

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"