Results 1 to 3 of 3

Thread: Find Last Used Row In A Column Using Long Variable

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Find Last Used Row In A Column Using Long Variable

    Hello,

    I know I'm going to show how amateur I am now but I can't seem to get it right. Code works fine if I use range up to 600 rows but I need to use more rows and so I need to set the range also 'as long' sort of thing. here is the code I have,

    Code:
    Dim rngFilter As Range, i As Long
    
    i = 1000
    
    Set rngFilter = Range("A10:U700" & Range("a" & Rows.Count).End(xlUp).Row)
    
    dDate = Date - 1
    
    If Application.WorksheetFunction.CountIf(rngFilter.Columns(21), dDate) Then
         rngFilter.AutoFilter field:=21, Criteria1:=dDate
              ActiveWindow.ScrollColumn = 1
         ActiveWindow.ScrollRow = 1
    Else
        MsgBox ("There were no deliveries yesterday!" & vbNewLine & dDate), vbOKOnly, "No Deliveries!"
    End If
    
    Set rngFilter = Nothing
    i = 0
    Any ideas?


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=kfQC-sQxMcw&lc=UgyCxQWypNIhG2nUn794AaABAg.9q1p6q7ah839t UQl_92mvg
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg. 9isY3Ezhx4j9itQLuif26T
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg. 9irSL7x4Moh9itTRqL7dQh
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg. 9irLgSdeU3r9itU7zdnWHw
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg. 9iraombnLDb9itV80HDpXc
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg. 9is0FSoF2Wi9itWKEvGSSq
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 08-16-2023 at 11:03 PM.

  2. #2

  3. #3
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    another way..

    Code:
    i = Range("a" & Rows.Count).End(xlUp).Row'last row in column a with data
    
    Set rngFilter = Range("A10:U" & i)
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Replies: 4
    Last Post: 04-05-2013, 12:08 PM
  2. Find the last row in a range
    By PcMax in forum Excel Help
    Replies: 7
    Last Post: 03-22-2013, 03:46 AM
  3. Vba Code to find value and paste on certain row
    By jwitte in forum Excel Help
    Replies: 3
    Last Post: 11-28-2012, 08:52 PM
  4. Find Last Used Row In Column
    By Rasm in forum Excel and VBA Tips and Tricks
    Replies: 2
    Last Post: 06-04-2012, 07:40 AM
  5. Find The Last Entry Row In A Column That Contains Only Numbers
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 05-09-2011, 05:19 AM

Tags for this Thread

Posting Permissions

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