bbaker0718
New Member
- Joined
- Dec 5, 2018
- Messages
- 3
I'm trying to set up a spreadsheet to help keep track of plugged numbers with subcontractors and my own estimating teams numbers.
we are keeping track of the numbers by colored font. light blue, red and black.
light blue is from our numbers, red is values that the sub is missing and black is the base number of the proposal.
after searching forums and google, I've come up with the UDF for sumbycolorfont which worked great, if i want to press f9 each time, i have 64 sheets i need this to work on, and that becomes an issue with multiple people adding numbers and using this file as reference, as i'm sure someone will forget to recalc and take the numbers for face value. so i started to look for a way to auto calc after the color change event. i found someone's advice for adding a SelectionChange event and tried it, that works great, however now i can't copy/paste anything as selecting a new cell activates the auto calc and my clipboard gets erased.
here are the udf's i'm using. how can i combine these or reorder the recalc command to the color change event only that allows me copy/paste, auto updates the formula and recognizes the font color change.
Function SumCellsByFontColor(rData As Range, cellRefColor As Range)
Dim indRefColor As Long
Dim cellCurrent As Range
Dim sumRes
Application.Volatile (True)
sumRes = 0
indRefColor = cellRefColor.Cells(1, 1).Font.Color
For Each cellCurrent In rData
If indRefColor = cellCurrent.Font.Color Then
sumRes = WorksheetFunction.Sum(cellCurrent, sumRes)
End If
Next cellCurrent
SumCellsByFontColor = sumRes
End Function
Private Sub Worksheet_Change(ByVal Target As Range)
Me.Calculate
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Calculate
End Sub
the sumbyfontcolor is on the workbook module and the me.calculate is on each sheet 1-64.
i'm new when it comes to this, so my understanding of how these things work is limited. any help would be greatly appreciated
p.s. if this has been talked about already, i'm sorry for posting a new post. after two days of searching, I've resorted to asking outright. If this has been covered, please if you could redirect me to the original post and i'll follow up there.
thank you,
we are keeping track of the numbers by colored font. light blue, red and black.
light blue is from our numbers, red is values that the sub is missing and black is the base number of the proposal.
after searching forums and google, I've come up with the UDF for sumbycolorfont which worked great, if i want to press f9 each time, i have 64 sheets i need this to work on, and that becomes an issue with multiple people adding numbers and using this file as reference, as i'm sure someone will forget to recalc and take the numbers for face value. so i started to look for a way to auto calc after the color change event. i found someone's advice for adding a SelectionChange event and tried it, that works great, however now i can't copy/paste anything as selecting a new cell activates the auto calc and my clipboard gets erased.
here are the udf's i'm using. how can i combine these or reorder the recalc command to the color change event only that allows me copy/paste, auto updates the formula and recognizes the font color change.
Function SumCellsByFontColor(rData As Range, cellRefColor As Range)
Dim indRefColor As Long
Dim cellCurrent As Range
Dim sumRes
Application.Volatile (True)
sumRes = 0
indRefColor = cellRefColor.Cells(1, 1).Font.Color
For Each cellCurrent In rData
If indRefColor = cellCurrent.Font.Color Then
sumRes = WorksheetFunction.Sum(cellCurrent, sumRes)
End If
Next cellCurrent
SumCellsByFontColor = sumRes
End Function
Private Sub Worksheet_Change(ByVal Target As Range)
Me.Calculate
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Calculate
End Sub
the sumbyfontcolor is on the workbook module and the me.calculate is on each sheet 1-64.
i'm new when it comes to this, so my understanding of how these things work is limited. any help would be greatly appreciated
p.s. if this has been talked about already, i'm sorry for posting a new post. after two days of searching, I've resorted to asking outright. If this has been covered, please if you could redirect me to the original post and i'll follow up there.
thank you,