+ Reply to Thread
Results 1 to 3 of 3

EntireRow.Delete produces a Last Line index that reaches the max 1048576 !!

  1. #1
    Registered User
    Join Date
    12-12-2023
    Location
    France,
    MS-Off Ver
    Professional Plus 2016
    Posts
    24

    EntireRow.Delete produces a Last Line index that reaches the max 1048576 !!

    Hello,

    I feel frustrated with the behavior of EntireRow.Delete. I show it in the short snippet below.

    Simply, I populate a table with 1 line (by hand or with the button 'populate') : the line contains 3 values : "1" , "91" , a date.

    Then, I try to erase the lines (I know there is only one ) that contain "91" in the second column...
    This works well with the EntireRow.Delete method : Excel erases my unique line (and keeps the header line) and this is fine.

    But, after deleting this line, I get Range('A1').End(xlDown).Row = 1048576 (the max!) and I don't understand why.

    I was expecting this value to be "1" (I still have my line with the titles).

    By the way, the value of Source.Cells(Source.Rows.Count, "A").End(xlUp).Row shows the correct value ("1") but I don't understand why Range('A1').End(xlDown).Row does not...

    Range('A1').End(xlDown).Row does not count the nb of lines before the first blank cell in A ?

    Thanks for any help, Pierre


    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    12-13-2023
    Location
    Mansfield, Ohio
    MS-Off Ver
    2019
    Posts
    12

    Re: EntireRow.Delete produces a Last Line index that reaches the max 1048576 !!

    You should replace Source.Range("A1").End(xlDown).Row with Source.Cells(Source.Rows.Count, "A").End(xlUp).Row. For whatever reason, Excel does not like searching down from a range and seemingly includes all the blank cells as part of the total number it finds.

  3. #3
    Registered User
    Join Date
    12-12-2023
    Location
    France,
    MS-Off Ver
    Professional Plus 2016
    Posts
    24

    Re: EntireRow.Delete produces a Last Line index that reaches the max 1048576 !!

    Yes...indeed... and thanks for your answer....I found out this 'subtlety' after a couple of hours !! I am going now to change all the similar lines in my application ...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Delete Method of Range Class Failed on SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    By BFid in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2021, 11:27 AM
  2. [SOLVED] entirerow.delete problem...
    By peterschein in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-29-2020, 08:40 AM
  3. Replies: 1
    Last Post: 01-23-2020, 01:45 AM
  4. iCell.EntireRow.Delete not working. Need code to Delete Entire Row
    By unit285 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-27-2017, 10:48 PM
  5. [SOLVED] Entirerow.delete
    By Prexcel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-17-2014, 09:16 PM
  6. [SOLVED] EntireRow.Delete
    By Steph in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-21-2005, 07:06 PM
  7. EntireRow.Delete Not what I want
    By spencermjax in forum Excel General
    Replies: 1
    Last Post: 01-14-2005, 11:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1