I'm having an issue making excel select the last cell in a particular column of a table. Here is the part that is causing trouble:
Current outcome:
The cells that are selected after the code runs is the range rngAuditNoColumn, which is NOT my goal. There is no error message. Do you know why the last cell of the table in the 6th column is not activated after executing this code? I feel like I'm missing something very simple.
Other info:
The name of the table won't always have the same name. The For loop is a workaround for that. The full code for the module is relatively long (for me, anyway). It involves copying worksheets, hiding and deleting table columns, and creating and saving new workbooks. Let me know if you want me to post the full module, but I'd rather avoid the hassle of removing any confidential information. Please let me know if there's any other information you require.
Thanks,
Kyle
VBA Code:
For Each lo In wksNew3.ListObjects
Set rngAuditNoColumn = lo.ListColumns(6).DataBodyRange
'the next 2 lines remove any references to the original workbook
rngAuditNoColumn.Copy
rngAuditNoColumn.PasteSpecial (xlPasteValues)
'select last cell in column 6 of table
'------------------------------>THE LINE BELOW IS THE PROBLEM! <-------------------------------------------
Cells(lo.HeaderRowRange.Row + lo.ListRows.Count, 6).Activate
Next lo
Current outcome:
The cells that are selected after the code runs is the range rngAuditNoColumn, which is NOT my goal. There is no error message. Do you know why the last cell of the table in the 6th column is not activated after executing this code? I feel like I'm missing something very simple.
Other info:
The name of the table won't always have the same name. The For loop is a workaround for that. The full code for the module is relatively long (for me, anyway). It involves copying worksheets, hiding and deleting table columns, and creating and saving new workbooks. Let me know if you want me to post the full module, but I'd rather avoid the hassle of removing any confidential information. Please let me know if there's any other information you require.
Thanks,
Kyle