-2

I think my question will be easy for some of you.

I have an Excel file for my task/activity tracking.

Column A is an ID auto-increment from 1 to 1000.

Column B is the taskname.

But I have only 100 tasks, so column B is empty at cell B101.

I want to select the first empty row without taskname (first row with column B being empty). But column A is not empty and gives me an error (I select the last row after A column value).

Thank you for reading this.

Regards,

Michael Wycisk
  • 1,590
  • 10
  • 24
  • Does this answer your question? [Error in finding last used cell in Excel with VBA](https://stackoverflow.com/questions/11169445/error-in-finding-last-used-cell-in-excel-with-vba) – Plutian Dec 18 '19 at 11:16

1 Answers1

0

I have a solution for what I want to do :

With Sheets(sheet).Range("Table1").Cells(1, 2).End(xlDown)
  .Offset(1, 0).Value = value1 
  .Offset(1, 1).Value = value2
  ...
End With

For some explication :

Sheets("your_sheet_name") Range("your_table_name") Cells(row number, column number)

. Offset(row, column "based on the column define on the cells parameter")

So for me :

. Offset(1, 0).Value = value1 -> insert value1 in the first empty cell of B column . Offset(1, 1).Value = value2 -> insert value2 in the same row but in column C

But that's don't work if the table is filtered. So it's needed to make a ListObject.ShowAllData before use the "with" .

Thank you for help, the links you share was very useful!

Regards,