Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Vic Vic is offline
external usenet poster
 
Posts: 117
Default Summary based on highlighted cells

I have asked this before, but got no answer - just more questions. I have
modified my request.

I need to create a macro to add the following numbers in cell A based on
highlighted cells in that row:
Add 17 in cell A if cell G is highlighted
Add 10 in cell A for each cell from H thru P that is highlighted
Add 1 in cell A for each cell from Q thru AA that is highlighted
Add 11 in cell A if cell AB is highlighted
Add 1 in cell A for each cell from AC thru AE that is highlighted

I need to do this for every row of my spreadsheet. By highlight I mean any
color except for white (no color). This macro should be executed by me
whenever all updates are in and I need totals.

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Summary based on highlighted cells

This macro checks for any type of highlighting (note that formatting a cell
with white background is different than "no fill") and calculated based on
the values you gave. Change the one "For" line values as appropriate for your
spreadsheet.

Sub HighlightCheck()

Dim xValue As Integer
Dim i As Integer


'Change these to your upper and
'lower boundaries for rows
For i = 2 To 10

xValue = 0
If Range("G" & i).Interior.ColorIndex < xlNone Then
xValue = xValue + 17
End If

For Each cell In Range("H" & i & ":P" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 10
End If
Next cell

For Each cell In Range("Q" & i & ":AA" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 1
End If
Next cell

If Range("AB" & i).Interior.ColorIndex < xlNone Then
xValue = xValue + 11
End If

For Each cell In Range("AC" & i & ":AE" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 1
End If
Next cell

Range("A" & i).Value = xValue
Next

End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Vic" wrote:

I have asked this before, but got no answer - just more questions. I have
modified my request.

I need to create a macro to add the following numbers in cell A based on
highlighted cells in that row:
Add 17 in cell A if cell G is highlighted
Add 10 in cell A for each cell from H thru P that is highlighted
Add 1 in cell A for each cell from Q thru AA that is highlighted
Add 11 in cell A if cell AB is highlighted
Add 1 in cell A for each cell from AC thru AE that is highlighted

I need to do this for every row of my spreadsheet. By highlight I mean any
color except for white (no color). This macro should be executed by me
whenever all updates are in and I need totals.

Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Summary based on highlighted cells

I should also mention that conditional formats are not detected either. If
you're using conditional formats though, you could build a formula based on
those, so this shouldn't be a problem.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Luke M" wrote:

This macro checks for any type of highlighting (note that formatting a cell
with white background is different than "no fill") and calculated based on
the values you gave. Change the one "For" line values as appropriate for your
spreadsheet.

Sub HighlightCheck()

Dim xValue As Integer
Dim i As Integer


'Change these to your upper and
'lower boundaries for rows
For i = 2 To 10

xValue = 0
If Range("G" & i).Interior.ColorIndex < xlNone Then
xValue = xValue + 17
End If

For Each cell In Range("H" & i & ":P" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 10
End If
Next cell

For Each cell In Range("Q" & i & ":AA" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 1
End If
Next cell

If Range("AB" & i).Interior.ColorIndex < xlNone Then
xValue = xValue + 11
End If

For Each cell In Range("AC" & i & ":AE" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 1
End If
Next cell

Range("A" & i).Value = xValue
Next

End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Vic" wrote:

I have asked this before, but got no answer - just more questions. I have
modified my request.

I need to create a macro to add the following numbers in cell A based on
highlighted cells in that row:
Add 17 in cell A if cell G is highlighted
Add 10 in cell A for each cell from H thru P that is highlighted
Add 1 in cell A for each cell from Q thru AA that is highlighted
Add 11 in cell A if cell AB is highlighted
Add 1 in cell A for each cell from AC thru AE that is highlighted

I need to do this for every row of my spreadsheet. By highlight I mean any
color except for white (no color). This macro should be executed by me
whenever all updates are in and I need totals.

Thank you.

  #4   Report Post  
Posted to microsoft.public.excel.misc
Vic Vic is offline
external usenet poster
 
Posts: 117
Default Summary based on highlighted cells

Thank you Luke,
How can I change to check for yellow and red highlighted cell only?
Apparently, there was a grey color that should be OK and I should not count
this in. Each cell represents a visit with the visit date or "&" for
scheduled visits with no dates. All other potential visits are blank and
grey. All visits with missing documentation are colored in yellow. All visits
with bad documentation are colored in red. I need to count missing and bad
documentation. Depending on the visit type it could be 1 or 10 or 11 or 17
pages.
Thank you.

"Luke M" wrote:

I should also mention that conditional formats are not detected either. If
you're using conditional formats though, you could build a formula based on
those, so this shouldn't be a problem.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Luke M" wrote:

This macro checks for any type of highlighting (note that formatting a cell
with white background is different than "no fill") and calculated based on
the values you gave. Change the one "For" line values as appropriate for your
spreadsheet.

Sub HighlightCheck()

Dim xValue As Integer
Dim i As Integer


'Change these to your upper and
'lower boundaries for rows
For i = 2 To 10

xValue = 0
If Range("G" & i).Interior.ColorIndex < xlNone Then
xValue = xValue + 17
End If

For Each cell In Range("H" & i & ":P" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 10
End If
Next cell

For Each cell In Range("Q" & i & ":AA" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 1
End If
Next cell

If Range("AB" & i).Interior.ColorIndex < xlNone Then
xValue = xValue + 11
End If

For Each cell In Range("AC" & i & ":AE" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 1
End If
Next cell

Range("A" & i).Value = xValue
Next

End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Vic" wrote:

I have asked this before, but got no answer - just more questions. I have
modified my request.

I need to create a macro to add the following numbers in cell A based on
highlighted cells in that row:
Add 17 in cell A if cell G is highlighted
Add 10 in cell A for each cell from H thru P that is highlighted
Add 1 in cell A for each cell from Q thru AA that is highlighted
Add 11 in cell A if cell AB is highlighted
Add 1 in cell A for each cell from AC thru AE that is highlighted

I need to do this for every row of my spreadsheet. By highlight I mean any
color except for white (no color). This macro should be executed by me
whenever all updates are in and I need totals.

Thank you.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Summary based on highlighted cells

We can change the macro to search for color indexex 3 and 6 (red and yellow
respectively).

Sub HighlightCheck()

Dim xValue As Integer
Dim i As Integer


'Change these to your upper and
'lower boundaries for rows
For i = 2 To 10

xValue = 0
'Yellow = 6
'Red = 3
If Range("G" & i).Interior.ColorIndex = 6 Or _
Range("G" & i).Interior.ColorIndex = 3 Then
xValue = xValue + 17
End If

For Each cell In Range("H" & i & ":P" & i)
If cell.Interior.ColorIndex = 6 Or _
cell.Interior.ColorIndex = 3 Then
xValue = xValue + 10
End If
Next cell

For Each cell In Range("Q" & i & ":AA" & i)
If cell.Interior.ColorIndex = 6 Or _
cell.Interior.ColorIndex = 3 Then
xValue = xValue + 1
End If
Next cell

If Range("AB" & i).Interior.ColorIndex = 6 Or _
Range("AB" & i).Interior.ColorIndex = 3 Then
xValue = xValue + 11
End If

For Each cell In Range("AC" & i & ":AE" & i)
If cell.Interior.ColorIndex = 6 Or _
cell.Interior.ColorIndex = 3 Then
xValue = xValue + 1
End If
Next cell

Range("A" & i).Value = xValue
Next

End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Vic" wrote:

Thank you Luke,
How can I change to check for yellow and red highlighted cell only?
Apparently, there was a grey color that should be OK and I should not count
this in. Each cell represents a visit with the visit date or "&" for
scheduled visits with no dates. All other potential visits are blank and
grey. All visits with missing documentation are colored in yellow. All visits
with bad documentation are colored in red. I need to count missing and bad
documentation. Depending on the visit type it could be 1 or 10 or 11 or 17
pages.
Thank you.

"Luke M" wrote:

I should also mention that conditional formats are not detected either. If
you're using conditional formats though, you could build a formula based on
those, so this shouldn't be a problem.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Luke M" wrote:

This macro checks for any type of highlighting (note that formatting a cell
with white background is different than "no fill") and calculated based on
the values you gave. Change the one "For" line values as appropriate for your
spreadsheet.

Sub HighlightCheck()

Dim xValue As Integer
Dim i As Integer


'Change these to your upper and
'lower boundaries for rows
For i = 2 To 10

xValue = 0
If Range("G" & i).Interior.ColorIndex < xlNone Then
xValue = xValue + 17
End If

For Each cell In Range("H" & i & ":P" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 10
End If
Next cell

For Each cell In Range("Q" & i & ":AA" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 1
End If
Next cell

If Range("AB" & i).Interior.ColorIndex < xlNone Then
xValue = xValue + 11
End If

For Each cell In Range("AC" & i & ":AE" & i)
If cell.Interior.ColorIndex < xlNone Then
xValue = xValue + 1
End If
Next cell

Range("A" & i).Value = xValue
Next

End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Vic" wrote:

I have asked this before, but got no answer - just more questions. I have
modified my request.

I need to create a macro to add the following numbers in cell A based on
highlighted cells in that row:
Add 17 in cell A if cell G is highlighted
Add 10 in cell A for each cell from H thru P that is highlighted
Add 1 in cell A for each cell from Q thru AA that is highlighted
Add 11 in cell A if cell AB is highlighted
Add 1 in cell A for each cell from AC thru AE that is highlighted

I need to do this for every row of my spreadsheet. By highlight I mean any
color except for white (no color). This macro should be executed by me
whenever all updates are in and I need totals.

Thank you.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Rows Based on highlighted Color Neon520 Excel Discussion (Misc queries) 7 March 28th 09 08:56 AM
PivotTables - Calculations based on generated summary data John Gibson Excel Discussion (Misc queries) 2 September 11th 08 12:30 PM
Selecting multiple cells, I can't see the cells highlighted ET Excel Discussion (Misc queries) 1 August 1st 08 03:20 PM
Summary Based on Multiple Criteria Phillycheese5 Excel Worksheet Functions 2 January 6th 06 03:06 PM
Create summary based on specifc value in a different sheet RayYeung Excel Worksheet Functions 0 July 19th 05 05:39 AM


All times are GMT +1. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"