Excel Macro VBA Tip 17 - Find Last Row and Last Column with VBA

Поділитися
Вставка
  • Опубліковано 6 вер 2024

КОМЕНТАРІ • 21

  • @synjyns1102
    @synjyns1102 11 років тому +1

    Here is another way to find the final row in a column and use it in a loop. So you could do something like this: Finalrow = cells(rows.count, 1).end(xlup).row where 1 is column A. If you had a 2 it would run in column B etc. Finalrow is set as a variable which will hold the finalrow number. You can then use the variable in a simple loop like this:
    for i = 1 to finalrow
    { enter your code}
    next i
    So this loop will run until it reaches the finalrow in column 1 or column A. Hope this helps!

  • @TeachExcel
    @TeachExcel  14 років тому

    This will work if the cell is a formula that returns " " - It is really such a useful feature to use in an Excel macro because of this.

  • @shyamumich
    @shyamumich 5 років тому

    Nice clear explanation. Worked for my needs. Thank you!

  • @sunilbarge4242
    @sunilbarge4242 11 років тому

    Hi, this was very useful and simple. Thanks for such a simple teaching with simple code.

  • @Seftehandle
    @Seftehandle 7 років тому +1

    Resume: range("Z3").End(xlToLeft).Select - to move from last row given in range to last cell where there is text
    Range("A100000").End(xlUp).Select - to move from given cell in collumn to last cell where there is text

  • @KayKayTutorials
    @KayKayTutorials 11 років тому

    I liked your tutorial on finding the last row. I created a tutorial that also covered finding the first & last column and row as well. I hope that it is useful to everyone.

  • @stewdogg42
    @stewdogg42 14 років тому

    Excellent tutorial. Many thanks!!

  • @GaryHutsonVBA
    @GaryHutsonVBA 12 років тому

    You could always use a Do....Until IsBlank as an alternative But I agree, sometimes you may want to select the last column and then you can use Offset to offset the column by 1 or -1. VBA is such a powerful beast - as we say in England there is more than one way to skin a cat.

  • @optionsupdate
    @optionsupdate 12 років тому

    thanks for video sir, how to I find the empty cell below the last data in a column

  • @ukrainesov21
    @ukrainesov21 12 років тому

    Isn't it easier to search for the last rows and columns from the beginning of the table, like from B1 instead of making the computer do extra work, counting from very far away??

  • @gimposer
    @gimposer 14 років тому

    Hi... I have a question... and this is coming from one of your earlier tuts, what if the last row actually is a formula and returning a blank " ". Will this still work. This is coming from your earlier tutorial where you mentioned the correct way to find the empty cell with a blank return value using the ISEMPTY formula. Thanks.

  • @tannertucker22
    @tannertucker22 8 років тому

    Thank you. This is excellent. How can I so the same with an Excel Table or Chart Data Range? Thank you.

  • @distantship
    @distantship 11 років тому

    And what if there are hidden rows or columns outside of the range of the actual data?

  • @jay55patel
    @jay55patel 7 років тому

    thank you

  • @calvintross8221
    @calvintross8221 7 років тому

    How to enter data to next empty column to the right ?

  • @carlosferreira7747
    @carlosferreira7747 7 років тому

    Hello! Good morning
    I am new to the VBA Excel, maybe you can help me.
    I'm creating DB in just one Spreadsheet, with 3 UserForms:
    UserForm Customers with on button that call the,
    UserForm Service with on button that call the,
    UserForm Type Services.
    I want to know if it's possible.
    1- If the Service was paid in Check I need to add 3 columns or Row Check Number, Amount and Date.
    2- If Service was paid per day I need to add 3 columns or Row 01/25/2017 - Travel Day, 01/26/2017 - Full Day - 01/27/2017 -
    Travel Day.
    Do I also need a code which tells the worksheet how many rows have been add to the next record skipped.e.g We have the word "Per Day"at the column P6. We need to add 3 rows, the next record has to be add at the column A10.
    thank you very much

  • @atmeo93
    @atmeo93 9 років тому

    Hey bro thanks a lot :)

  • @SteveTremper
    @SteveTremper 8 років тому

    I copied this code exactly but just get error 1004.

  • @ukrainesov21
    @ukrainesov21 12 років тому

    Good job, bud. However, at 4:00 it's Row 3, not Column!! ;)

  • @Innovlrnr
    @Innovlrnr Рік тому

    I am seeing this video after 13 years

  • @ValmisFilm
    @ValmisFilm 6 років тому

    ok, but how to do this: I have an adress, lets say "home" and under it I have empty and non-emty cells. I want to find the last non-emty cell - how? I mean how to make it so taht VBA knows in witch column this is done.