+ Reply to Thread
Results 1 to 8 of 8

Help! Select blank cell in a filtered list

Hybrid View

yoko21 Help! Select blank cell in a... 10-05-2013, 05:24 AM
oeldere Re: Help! Select blank cell... 10-05-2013, 05:52 AM
yoko21 Re: Help! Select blank cell... 10-05-2013, 07:12 AM
oeldere Re: Help! Select blank cell... 10-05-2013, 11:09 AM
aylerk Re: Help! Select blank cell... 10-05-2013, 11:45 AM
jaslake Re: Help! Select blank cell... 10-05-2013, 11:57 AM
yoko21 Re: Help! Select blank cell... 10-05-2013, 12:43 PM
jaslake Re: Help! Select blank cell... 10-05-2013, 01:02 PM
  1. #1
    Registered User
    Join Date
    09-23-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    33

    Red face Help! Select blank cell in a filtered list

    scenario: I have a list of clients in column A with the corresponding debt amount in column B. I made a code to filter the clients with a particular surname which I coded successfully. What I want to do now is to total the debt amount of the clients filtered. I want the word "TOTAL"in column A 3 cells down after the last client in the filtered list and the total debt amount in column B in the same row as the word "TOTAL". The assumption is you don't exactly know how long the list is so it is useless to make a code to put the "total" in a specific cell. My question: how do I select the blank cell 3 steps below the last filtered client? (say the last client filtered is on cell 50 in a total of 800 clients. Thus, when you perform the filter it will hide cells 51 up to 800). I want to select cell 803 to put the word "TOTAL". I tried the activecell offset etc... it still selects cell 53 and not 803. It would have been easy if I am allowed to delete the clients I do not want to filter... but I cant.

    Cheers

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Help! Select blank cell in a filtered list

    Another approach.

    Why not make the total above the selection (e.g. in cell A2).

    The advance of that approach is that you alway see, the result (and it can also be printed on all sheets).
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    09-23-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Help! Select blank cell in a filtered list

    Quote Originally Posted by oeldere View Post
    Another approach.

    Why not make the total above the selection (e.g. in cell A2).

    The advance of that approach is that you alway see, the result (and it can also be printed on all sheets).
    Actually, I already did that. But my boss want it at the bottom. Is it possible?

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Help! Select blank cell in a filtered list

    Another approach.

    Make a pivot table of your data.

  5. #5
    Registered User
    Join Date
    10-05-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Help! Select blank cell in a filtered list

    If you don't want to use PV Tables, you could try something like:

    dim rngClient, rngAmount as Range
    dim n as integer

    set rngClient = Activeworkbook.Activeworksheet.Range("A:A")
    set rngAmount = Activeworkbook.Activeworksheet.Range("B:B")

    n = Activeworkbook.Activeworksheet.UsedRange.Rows().Count + 3

    rngClient.Rows(n).Value = "Total"
    rngAmount.Rows(n).Value = [Your filtered sum]

    This should get you to where you can start entering data 3 rows after the used range.

    *changed to usedrange.rows() for n
    Last edited by aylerk; 10-05-2013 at 11:57 AM.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help! Select blank cell in a filtered list

    Hi yoko21

    Play with this
    Option Explicit
    
    Sub SubTot()
    
        Dim LR As Long, LR1 As Long
        With Sheets("Sheet1")
            
            'Find Last Row in Column A With Data (plus 1)
            LR1 = .Range("A" & .Rows.Count).End(xlUp).Row + 1
    
            'Find True Last Row With Data (plus 3)
            LR = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious).Row + 3
            
            'Clear Data from Column B below LR1 (the Old Formula)
            .Range("B" & LR1 & ":B" & LR).ClearContents
            
            'Find the New True Last Row (plus 3)
            LR = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious).Row + 3
            
            'Put this Formula in that Cell
            .Range("B" & LR).Formula = "=SUBTOTAL(109,B2:B" & LR - 3 & ")"
            
        End With
    End Sub
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  7. #7
    Registered User
    Join Date
    09-23-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Help! Select blank cell in a filtered list

    Quote Originally Posted by jaslake View Post
    Hi yoko21

    Play with this
    Option Explicit
    
    Sub SubTot()
    
        Dim LR As Long, LR1 As Long
        With Sheets("Sheet1")
            
            'Find Last Row in Column A With Data (plus 1)
            LR1 = .Range("A" & .Rows.Count).End(xlUp).Row + 1
    
            'Find True Last Row With Data (plus 3)
            LR = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious).Row + 3
            
            'Clear Data from Column B below LR1 (the Old Formula)
            .Range("B" & LR1 & ":B" & LR).ClearContents
            
            'Find the New True Last Row (plus 3)
            LR = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious).Row + 3
            
            'Put this Formula in that Cell
            .Range("B" & LR).Formula = "=SUBTOTAL(109,B2:B" & LR - 3 & ")"
            
        End With
    End Sub
    Hi John,

    I tested your code in a 20 client list and noticed the following:
    Without filtering - It worked perfectly. The computation was made 3 cells below the last client in the list.
    Filtered. Only including the clients from 1-10 and 15-20. - The computation was made 2 cells below the last client in the list.
    Filtered. Only including clients from 1-15. No computation was made and deleted the last to data in column B.
    Last edited by yoko21; 10-05-2013 at 12:45 PM.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help! Select blank cell in a filtered list

    Hi yoko21

    Please don't Quote entire Posts...include only those items that are relevant.

    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and an "After" worksheet that demonstrates what you wish the output to be.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the "Add Files"... button to locate your file for uploading.
    6. This will open a new window File Upload...Click "Select Files"
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the "Upload Files" button and wait until the file has uploaded.
    10. Click the "Done" Button.

+ 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] Macro to select visible rows containg data in filtered list
    By knevil in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-15-2013, 01:22 PM
  2. [SOLVED] Selecting a range of blank cells in a filtered list
    By mike_vr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2013, 06:24 AM
  3. Replies: 3
    Last Post: 04-11-2013, 04:13 AM
  4. Select the first cell of a filtered list?
    By Shane Moore in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-22-2010, 03:18 PM
  5. [SOLVED] Select data in filtered list
    By Stephen Rainey in forum Excel General
    Replies: 2
    Last Post: 07-28-2006, 07:40 AM

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