+ Reply to Thread
Results 1 to 8 of 8

Thread: Reading Row headers into a listbox

  1. #1
    Steve
    Guest

    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. #2
    Tom Ogilvy
    Guest

    RE: 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. #3
    Steve
    Guest

    RE: 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. #4
    Steve
    Guest

    RE: 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


  5. #5
    Steve
    Guest

    RE: 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


  6. #6
    Paul Mathews
    Guest

    RE: 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


  7. #7
    Steve
    Guest

    RE: 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


  8. #8
    Tom Ogilvy
    Guest

    RE: 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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0