Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ted Ted is offline
external usenet poster
 
Posts: 48
Default how do I get a formula to automatically refresh that's a macro?

i have a formula that counts cells that have been highlighted.
But I have to redrag it to get it to refresh after I highlight cells...
can someone tell me how to get it to automatically refresh after I highlight
cells?

Please help...
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default how do I get a formula to automatically refresh that's a macro?

Can we see the formula?

Have you tried [F9] - not automatically refreshing, but might work and it
would be a one-key-click solution.

"Ted" wrote:

i have a formula that counts cells that have been highlighted.
But I have to redrag it to get it to refresh after I highlight cells...
can someone tell me how to get it to automatically refresh after I highlight
cells?

Please help...
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ted Ted is offline
external usenet poster
 
Posts: 48
Default how do I get a formula to automatically refresh that's a macro

=COUNTBYCOLOR(B$4:B$111,CELLCOLORINDEX($A117,FALSE ),FALSE)
and the following are the functions I pasted into the VBA




Function FindShades(a As Range) As Integer
FindShades = 0
For Each c In a
If c.Interior.ColorIndex < xlColorIndexNone Then
FindShades = FindShades + 1
End If
Next c
End Function



Function CellColorIndex(InRange As Range, Optional _
OfText As Boolean = False) As Integer
'
' This function returns the ColorIndex value of a the Interior
' (background) of a cell, or, if OfText is true, of the Font in the cell.
'
Application.Volatile True
If OfText = True Then
CellColorIndex = InRange(1, 1).Font.ColorIndex
Else
CellColorIndex = InRange(1, 1).Interior.ColorIndex
End If

End Function


Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
'
' This function return the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex.
'
Dim Rng As Range
Application.Volatile True

For Each Rng In InRange.Cells
If OfText = True Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng

End Function


"JLatham" wrote:

Can we see the formula?

Have you tried [F9] - not automatically refreshing, but might work and it
would be a one-key-click solution.

"Ted" wrote:

i have a formula that counts cells that have been highlighted.
But I have to redrag it to get it to refresh after I highlight cells...
can someone tell me how to get it to automatically refresh after I highlight
cells?

Please help...
Thanks

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default how do I get a formula to automatically refresh that's a macro

Well, I don't know what we can do. My next suggestion was going to be to
(maybe) add
Application.Volatile
as part of the code, but it is already there.

What you can do that may be easier than doing the drag operation is to pick
an empty cell on the sheet and type a number, any number, into it. The
formula should update then. You can either leave the number in that 'force
update' cell, or delete it.

"Ted" wrote:

=COUNTBYCOLOR(B$4:B$111,CELLCOLORINDEX($A117,FALSE ),FALSE)
and the following are the functions I pasted into the VBA




Function FindShades(a As Range) As Integer
FindShades = 0
For Each c In a
If c.Interior.ColorIndex < xlColorIndexNone Then
FindShades = FindShades + 1
End If
Next c
End Function



Function CellColorIndex(InRange As Range, Optional _
OfText As Boolean = False) As Integer
'
' This function returns the ColorIndex value of a the Interior
' (background) of a cell, or, if OfText is true, of the Font in the cell.
'
Application.Volatile True
If OfText = True Then
CellColorIndex = InRange(1, 1).Font.ColorIndex
Else
CellColorIndex = InRange(1, 1).Interior.ColorIndex
End If

End Function


Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
'
' This function return the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex.
'
Dim Rng As Range
Application.Volatile True

For Each Rng In InRange.Cells
If OfText = True Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng

End Function


"JLatham" wrote:

Can we see the formula?

Have you tried [F9] - not automatically refreshing, but might work and it
would be a one-key-click solution.

"Ted" wrote:

i have a formula that counts cells that have been highlighted.
But I have to redrag it to get it to refresh after I highlight cells...
can someone tell me how to get it to automatically refresh after I highlight
cells?

Please help...
Thanks

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ted Ted is offline
external usenet poster
 
Posts: 48
Default how do I get a formula to automatically refresh that's a macro

Thanks,

I think your F-9 button thing works just fine.
I added it as a Macro to a button that says: REFRESH FORMULAS.

"JLatham" wrote:

Well, I don't know what we can do. My next suggestion was going to be to
(maybe) add
Application.Volatile
as part of the code, but it is already there.

What you can do that may be easier than doing the drag operation is to pick
an empty cell on the sheet and type a number, any number, into it. The
formula should update then. You can either leave the number in that 'force
update' cell, or delete it.

"Ted" wrote:

=COUNTBYCOLOR(B$4:B$111,CELLCOLORINDEX($A117,FALSE ),FALSE)
and the following are the functions I pasted into the VBA




Function FindShades(a As Range) As Integer
FindShades = 0
For Each c In a
If c.Interior.ColorIndex < xlColorIndexNone Then
FindShades = FindShades + 1
End If
Next c
End Function



Function CellColorIndex(InRange As Range, Optional _
OfText As Boolean = False) As Integer
'
' This function returns the ColorIndex value of a the Interior
' (background) of a cell, or, if OfText is true, of the Font in the cell.
'
Application.Volatile True
If OfText = True Then
CellColorIndex = InRange(1, 1).Font.ColorIndex
Else
CellColorIndex = InRange(1, 1).Interior.ColorIndex
End If

End Function


Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
'
' This function return the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex.
'
Dim Rng As Range
Application.Volatile True

For Each Rng In InRange.Cells
If OfText = True Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng

End Function


"JLatham" wrote:

Can we see the formula?

Have you tried [F9] - not automatically refreshing, but might work and it
would be a one-key-click solution.

"Ted" wrote:

i have a formula that counts cells that have been highlighted.
But I have to redrag it to get it to refresh after I highlight cells...
can someone tell me how to get it to automatically refresh after I highlight
cells?

Please help...
Thanks



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default how do I get a formula to automatically refresh that's a macro

Great! I posted the 2nd post 'cause I thought maybe it didn't work, I hadn't
tested it at that time so I just went looking for another way without testing
[F9] myself.

"Ted" wrote:

Thanks,

I think your F-9 button thing works just fine.
I added it as a Macro to a button that says: REFRESH FORMULAS.

"JLatham" wrote:

Well, I don't know what we can do. My next suggestion was going to be to
(maybe) add
Application.Volatile
as part of the code, but it is already there.

What you can do that may be easier than doing the drag operation is to pick
an empty cell on the sheet and type a number, any number, into it. The
formula should update then. You can either leave the number in that 'force
update' cell, or delete it.

"Ted" wrote:

=COUNTBYCOLOR(B$4:B$111,CELLCOLORINDEX($A117,FALSE ),FALSE)
and the following are the functions I pasted into the VBA




Function FindShades(a As Range) As Integer
FindShades = 0
For Each c In a
If c.Interior.ColorIndex < xlColorIndexNone Then
FindShades = FindShades + 1
End If
Next c
End Function



Function CellColorIndex(InRange As Range, Optional _
OfText As Boolean = False) As Integer
'
' This function returns the ColorIndex value of a the Interior
' (background) of a cell, or, if OfText is true, of the Font in the cell.
'
Application.Volatile True
If OfText = True Then
CellColorIndex = InRange(1, 1).Font.ColorIndex
Else
CellColorIndex = InRange(1, 1).Interior.ColorIndex
End If

End Function


Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
'
' This function return the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex.
'
Dim Rng As Range
Application.Volatile True

For Each Rng In InRange.Cells
If OfText = True Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng

End Function


"JLatham" wrote:

Can we see the formula?

Have you tried [F9] - not automatically refreshing, but might work and it
would be a one-key-click solution.

"Ted" wrote:

i have a formula that counts cells that have been highlighted.
But I have to redrag it to get it to refresh after I highlight cells...
can someone tell me how to get it to automatically refresh after I highlight
cells?

Please help...
Thanks

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
Can i get advanced filter to automatically refresh RichCovo Excel Worksheet Functions 3 April 5th 23 01:16 PM
Refresh Pivot Table Automatically anandmr65 Excel Discussion (Misc queries) 1 July 11th 06 01:04 PM
Refresh workbook automatically Richard Excel Worksheet Functions 1 February 7th 06 05:44 AM
If someone makes a change does this automatically refresh? Keri5374 Excel Discussion (Misc queries) 1 January 5th 06 03:37 AM
Formula do not refresh automatically PS Excel Discussion (Misc queries) 3 May 9th 05 08:11 AM


All times are GMT +1. The time now is 11:32 AM.

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"