+ Reply to Thread
Results 1 to 5 of 5

Only apply formula for visible cells isn't working

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    01-10-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    651

    Re: Only apply formula for visible cells isn't working

    interesting... i'd have expected to be able to use subtotal to help you out, but apparently subtotal does not like embedded formulas... how do you feel about changing X's to 1's? can make it look like an X with formatting if that's important to you... not sure what O's represent, but i guess those would have to be 1's as well for the solution i have in mind.

    another thought is to use the same macros you're calling when a shop is selected to calculate those %'s... something like:

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Address(True, True) = "$A$2" Then
    'simarui additional code
            Dim LastCol As Long, x As Long, ItemCount As Long, VisibleCols As Long, LastRow As Long, rng As Range
            ItemCount = 0
            VisibleCols = 0
            LastCol = ActiveSheet.Cells(2, Columns.Count).End(xlToLeft).Column
            LastRow = Range("A" & Rows.Count).End(3).Row
    'end of simarui code
            Select Case Range("A2")
            'Target
                Case "All"
                    Call ALL
                Case "Shop1"
                    Call Shop1
                Case "Shop2"
                    Call Shop2
                Case "Shop3"
                    Call Shop3
                Case "Shop4"
                    Call Shop4
                Case "Shop5"
                    Call Shop5
                Case "Shop6"
                    Call Shop6
                Case Else
                    'Do nothing
            End Select
    'simarui additional code
            For Each rng In Range("A12:A" & LastRow)
            ItemCount = 0
            VisibleCols = 0
                For x = 4 To LastCol
                    
                    If Columns(x).Hidden = False Then
                        VisibleCols = VisibleCols + 1
                        If UCase(Cells(rng.Row, x)) = "X" Or UCase(Cells(rng.Row, x) = "O") Then _
                            ItemCount = ItemCount + 1
                    End If
                Next
                Range("B" & rng.Row) = ItemCount / VisibleCols
            Next rng
    'end of simarui code
        End If
    End Sub
    Last edited by simarui; 02-17-2016 at 03:33 PM. Reason: added vba option
    Hope I could help - if your post has been solved don't forget to mark it as such.

    Clicking the * below is a great way to say thanks!

    "Drowning in 10 feet of water isn?t any different than drowning in a million feet. And if you can swim, it doesn?t matter how deep the ocean is. At some level, once you realize you?re in water that?s too deep to stand, you have to have a very different approach," - Joi Ito

+ 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. paste visible cells not working!!!!
    By meus in forum Excel General
    Replies: 4
    Last Post: 12-24-2014, 09:51 AM
  2. [SOLVED] how do you apply formatting to just visible cells?
    By ammartino44 in forum Excel General
    Replies: 4
    Last Post: 05-06-2014, 08:01 PM
  3. Apply COUNTIF to visible cells in a range
    By Belthasar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-21-2013, 05:15 AM
  4. [SOLVED] MAC - Paste only to visible cells not working
    By Lija in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 6
    Last Post: 05-13-2013, 10:57 AM
  5. Apply formula only to visible cells after filtering
    By excelnd in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-28-2012, 06:47 AM
  6. Apply formula only to visible cells
    By Fatboy10 in forum Excel General
    Replies: 2
    Last Post: 06-17-2012, 07:34 AM
  7. Copy visible cells macro not working
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-16-2010, 10:07 AM

Tags for this Thread

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