+ Reply to Thread
Results 1 to 4 of 4

Entering Set Value For Blank Records After Autofilter

  1. #1
    Registered User
    Join Date
    08-20-2014
    Location
    CLT
    MS-Off Ver
    2010
    Posts
    61

    Entering Set Value For Blank Records After Autofilter

    Good afternoon,

    I am looking to Autofilter data to only show records that have blanks in Column E of my dataset. Once filtered, I am counting the records to determine if any blank records exist. If there are blank records, I want column E to be populated with a value. I have gotten the filter part to work correctly, but am unable to get the macro to enter the value. Please see below for what I currently have.

    Range("E:E").AutoFilter Field:=1, Criteria1:="="
    BlankCount = ActiveSheet.AutoFilter.Range.Columns(1).SpecialCells(xlCellTypeVisible).Count - 1

    If (BlankCount > 0) Then
    ActiveSheet.AutoFilter.Range("G2:G" & TotalRowCount).SpecialCells(xlCellTypeVisible).Value = "PENDING"
    End If

    BlankCount and TotalRowCount are declared as Integers.

    Thanks.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Entering Set Value For Blank Records After Autofilter

    Please use code tags as per forum's rule.
    If the cells are REAL empty after the filter, you can try

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-20-2014
    Location
    CLT
    MS-Off Ver
    2010
    Posts
    61

    Re: Entering Set Value For Blank Records After Autofilter

    Please disregard, I have solved this.

    Updated code:

    Range("E:E").AutoFilter Field:=1, Criteria1:="="
    BlankCount = ActiveSheet.AutoFilter.Range.Columns(1).SpecialCells(xlCellTypeVisible).Count - 1

    If (BlankCount > 0) Then
    Range("E2:E" & PreClassRowCount).SpecialCells(xlCellTypeVisible).Value = "PENDING"
    End If

  4. #4
    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: Entering Set Value For Blank Records After Autofilter

    Hi zmster2033

    Please wrap any Code you post in Code Tags.

    Please post the entire Code (wrapped in Code Tags of course)...can't tell what TotalRowCount evaluates to.
    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.

+ 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] No Records Found (autofilter)
    By bmcgrath in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2012, 02:23 PM
  2. Replies: 3
    Last Post: 01-06-2012, 11:16 PM
  3. Entering multiple records in one form
    By Newtonboy in forum Excel General
    Replies: 1
    Last Post: 07-13-2006, 03:40 AM
  4. [SOLVED] Autofilter number of records
    By Ginger in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-28-2005, 11:05 AM
  5. Number records after Autofilter
    By fragher75 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-11-2005, 11:14 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