+ Reply to Thread
Results 1 to 5 of 5

Solved >>> Finding Last Column in Row

  1. #1
    Registered User
    Join Date
    10-22-2007
    Posts
    37

    Solved >>> Finding Last Column in Row

    Good evening. I have been playing with code to try to find the last column in a row in order to add the contents of the row to a combobox list.

    Please Login or Register  to view this content.

    This code is similar to code I have working to find the last row in a column... but when I attempt to run the above the first line gets highlighted with the following error: "Run-time error '1004': Application-defined or object-defined error."

    I am always paranoid about spaces in sheet names messing me up (the sheet names are someone else's), so I have tried replacing "Address Dropdown List" with Sheet8.Name - which gives me a Run-time error 9: Subscript out of range error... which seems odd (I thought that was only for incorrect array values?).


    I have never used R1C1 values before, but I'm pretty sure I've used those correctly here. I think they are necessary to use here as the Cells function is giving me a numeric value for the last column, which isn't as easily converted to a letter as it should be just to use an R1C1 value, right?

    Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    Try changing:
    xlLeft
    to
    xlToLeft

  3. #3
    Registered User
    Join Date
    10-22-2007
    Posts
    37

    doh!

    Doh! Good catch there = /

    Now it's throwing me: "Run-time error 380: could not set the RowSource property. Invalid property value"... which leads me to believe I am not using the R1C1 values, at least is my guess?

    RowSource is supposed to take ranges, do they take R1C1 ranges (I can only assume yes)? Or is there an easy way to say: this column number == this corresponding letter (col 1 = A, col 2 = B ...) without me hard-coding it in? I think the R1C1 value would probably work better, right? ; )
    Last edited by rokuk; 10-24-2007 at 05:57 PM.

  4. #4
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    You could do this:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-22-2007
    Posts
    37

    super!

    That worked a treat! It took me awhile to figure out how it worked, but it's working very well.

    Thank you so much!

+ 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.6.0 RC 1