Using VBA, how can I enter a value into a cell that has been filtered?
Results 1 to 4 of 4

Thread: Using VBA, how can I enter a value into a cell that has been filtered?

  1. #1
    Board Regular
    Join Date
    Jul 2007
    Location
    England
    Posts
    438
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Using VBA, how can I enter a value into a cell that has been filtered?

    I have a range of data with filters on. I have a macro that applies one of the filters and what I now want to do is just enter a "1" in Column A next to cells that are visible when filtered.

    I have tried having a variable and adding one to the variable to move to the next cell and also using the activecell.offset option, but it still enters data into the cells that should be hidden by the filter.

    How can I just enter a value into visible cells only?

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    27,029
    Post Thanks / Like
    Mentioned
    461 Post(s)
    Tagged
    46 Thread(s)

    Default Re: Using VBA, how can I enter a value into a cell that has been filtered?

    How about
    Code:
    Sub bruty()
       Range("A:A").SpecialCells(xlVisible).Value = 1
    End Sub
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  3. #3
    Board Regular
    Join Date
    Jul 2007
    Location
    England
    Posts
    438
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Using VBA, how can I enter a value into a cell that has been filtered?

    Quote Originally Posted by Fluff View Post
    How about
    Code:
    Sub bruty()
       Range("A:A").SpecialCells(xlVisible).Value = 1
    End Sub
    Got that working. Many thanks for the help

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    27,029
    Post Thanks / Like
    Mentioned
    461 Post(s)
    Tagged
    46 Thread(s)

    Default Re: Using VBA, how can I enter a value into a cell that has been filtered?

    You're welcome & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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