+ Reply to Thread
Results 1 to 5 of 5

Finding last row excluding formatting

Hybrid View

maym Finding last row excluding... 09-30-2018, 05:13 AM
PCI Re: Finding last row... 09-30-2018, 05:27 AM
Fluff13 Re: Finding last row... 09-30-2018, 11:22 AM
Joske920 Re: Finding last row... 09-30-2018, 11:52 AM
maym Re: Finding last row... 09-30-2018, 07:26 PM
  1. #1
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Finding last row excluding formatting

    Hi,

    I have a spreadsheet with formatting (sample attached).

    I am trying to locate the first empty row (in this case it is cell A10) but because the sheet is formatted, it goes straight to the last row with formatting (A1520).

    I am using the below:

    last_row = Sheets("ORDERS").Range("A65536").End(xlUp).Row
    How can I go to A10 instead of A1520?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Finding last row excluding formatting

    Try


    Option Explicit
    
    Sub Macro1()
    Dim last_row  As Integer
        last_row = Sheets("ORDERS").Range("A" & Rows.Count).End(xlUp).End(xlUp).Row
        last_row = Sheets("ORDERS").Range("A7").End(xlDown).Row
    End Sub
    Last edited by PCI; 09-30-2018 at 01:17 PM. Reason: Additional statement added
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,746

    Re: Finding last row excluding formatting

    Another option
       last_row = Sheets("ORDERS").Range("A:A").find("*", , xlValues, , xlByRows, xlPrevious, , , False).Row

  4. #4
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: Finding last row excluding formatting

    Try what fits best is your opinion

    
    Sub test()
    Dim last_row As Long
       last_row = Sheets("ORDERS").Columns(1).Find(What:=vbNullString, LookAt:=xlWhole, After:=Sheets("ORDERS").Range("A7")).Row
       last_row = Sheet4.Columns(1).Find(What:=vbNullString, LookAt:=xlWhole, After:=Cells(7, 1)).Row
    End Sub
    mind that columns needs to be synced too

    Grtz
    Last edited by Joske920; 10-05-2018 at 11:36 AM.

  5. #5
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Re: Finding last row excluding formatting

    thank you! These options work great

+ 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. Finding k most occurring text excluding previous results. Please Help
    By LeanneR in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-20-2017, 10:12 AM
  2. Finding Minimum Excluding the zero
    By thong127 in forum Excel General
    Replies: 18
    Last Post: 10-21-2016, 01:31 PM
  3. Replies: 1
    Last Post: 09-16-2014, 02:30 PM
  4. Replies: 1
    Last Post: 12-04-2013, 08:50 AM
  5. [SOLVED] Finding the minimum value in a range but excluding one value
    By Wilgoss in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-04-2012, 08:39 AM
  6. [SOLVED] Formula for finding range of numbers excluding outliers
    By Granny Nanny in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-20-2012, 10:33 AM
  7. Finding Maximum value while excluding some values
    By tx12345 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 02-04-2006, 05:10 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