I have a table that is populated with data and I am trying to find the last cell that has data in it. When I try to search I either can't get the last column or I only get the last column. Here's the code:
Range(Split(ThisWorkbook.Worksheets(1).Columns(Range(Range("A1").End(xlToRight).Offset(1, 0).Address).End(xlToLeft).Column).Address, ":")(0) & "1:" & Split(ThisWorkbook.Worksheets(1).Columns(Range(Range("A1").End(xlToRight).Offset(1, 0).Address).End(xlToLeft).Column).Address, ":")(0) & Range(ThisWorkbook.PintsTotLoc).Row + 2).Select
That code will find the first populated cell with data in it, but if the table is fully filled out from left to right the furthest right column won't get picked up as the last populated cell. So I tried:
Range(Split(ThisWorkbook.Worksheets(1).Columns(Range(Range("A1").End(xlToRight).Offset(1, 1).Address).End(xlToLeft).Column).Address, ":")(0) & "1:" & Split(ThisWorkbook.Worksheets(1).Columns(Range(Range("A1").End(xlToRight).Offset(1, 1).Address).End(xlToLeft).Column).Address, ":")(0) & Range(ThisWorkbook.PintsTotLoc).Row + 2).Select
Which will only get the furthest right column in the table if its blank or not. I'm assuming that the code is thinking that a table is "data" and shows that cell as populated. How can I search the table from right to left?
Note: I can't search from left to right because there may be some blank columns within the table.
Bookmarks