Search results

  1. K

    Read headers from Excel Worksheet

    Okay, below is the final working code. Thank you guys so much for the help! For anyone else using this in the future, make sure to set the value of the combobox to Null before this code runs. And set the column width to more than the 0" default so you can see it! Lol The only downside is that...
  2. K

    Read headers from Excel Worksheet

    That's the question though.....how do I set the range? I need all the headers, it will always start at A1 but every file will have different numbers of columns. So the range needs to be dynamic and return the value of every cell in row 1 until it's empty.
  3. K

    Read headers from Excel Worksheet

    Okay so this...… Debug.Print objWsh.Range("A1").Value DOES WORK!!! Yay!! Lol. 1 step out of the way. So now how do I get it to read all the way across row 1 until there isn't anything left? I felt like I could do something with the line "Set Rng = objWsh("A" & I).End(xlToRight).Column" but no...
  4. K

    Read headers from Excel Worksheet

    Thank you for the tip on using the For Each! Hadn't thought about that was just looking at what I had just used. Although I can't even seem to get to that point in the code anyway. Lol I tried just the below little sliver of code and I get object doesn't support this property or method on the...
  5. K

    Read headers from Excel Worksheet

    I'm not sure what else would cause an "Application-defined or object-defined error" on any line that has Cells in it. With late binding I can't use Range, Workbook, Worksheet, or anything else that would be defined in the Excel library, so I'm guessing Cells falls into that list too.
  6. K

    Read headers from Excel Worksheet

    Object defined error. As I said, I have to use late binding so I can't use Cells, Range, etc. All I need is all of the values in Row 1 until there is nothing left in it.
  7. K

    Read headers from Excel Worksheet

    The code you gave might work if I could use the reference Cells.
  8. K

    Read headers from Excel Worksheet

    I have to wait until the user picks a worksheet before I will know what headers to populate. So I do have it on the after update event of the Worksheet selection box. This is really messy, just playing with ideas and testing, hence all the commented out rows. I think it's a decent direction but...
  9. K

    Read headers from Excel Worksheet

    It looks like that is going through all the worksheets instead of just the one that was selected in the previous dropdown? It gives me an undefined error on Cells, I have to use late binding. And wouldn't adding both the name and the value of the cell give me 2 columns? Like "A1 Imports" "B1...
  10. K

    Read headers from Excel Worksheet

    I have a fairly simple form with several comboboxes to allow users to tell me specifically what records they need to have updated. (Small part of a ticketing system) First there is a FileDialog button so they can select their Excel file. Then the next combo is populated by just reading each of...
Top Bottom