View Single Post
 
Old 01-03-2018, 09:49 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

in D50 enter formula =SUM(D34: D46)
in D52 enter formula =D50-D48
in G50 enter formula =SUM(G34:G46)
in G52 enter formula =G50-G48

Code:
Sub sbRangeFillColorExample3()
     ' reset/clear button
     Range("B34:h46").Interior.Color = RGB(255, 255, 255)
     Range("D48").Formula = "=SUM(D34:D46)"
     Range("G48").Formula = "=SUM(G34:G46)"
End Sub
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    'limit to single cell
    If Target.Count > 1 Then Exit Sub
    'limit to Company column
    If Intersect(Target, Range("B34:B46")) Is Nothing Then Exit Sub
    ' ok to continue
    Intersect(Target.EntireRow, Range("B33:H46")).Cells.Interior.Color = RGB(255, 255, 9)
    Range("D48") = Range("D48") - Range("D" & Target.Row)
    Range("G48") = Range("G48") - Range("G" & Target.Row)
End Sub
A picture is not a worksheet.
Posting an actual worksheet would likely get better solutions.
Reply With Quote