Hi,
I did some research, but so far I haven't found an answer to my problem. Hopefully I can get some hints here.
I wrote the IsChangeopen() function (UDF, show futhrer down) to display "Closed" if out of 5 cells in the same row, all of them are colored (marking a complete status). If one or more cells are not colored, then "Open" shall be displayed.
I enter the functions in, say, cell K5 as =IsChangeOpen(F5;G5;H5;I5;J5). This initlally works as desired: If any of cells F5 to J5 are non-colored, then "Open" is shown in cell K5; otherwise "Closed" is shown.
I have activated auto filters, so that I can easily choose only "Open" rows to be shown. Changing the filter manually between "Open" and "all" rows works perfectly. The K cells show the desired values and the filter selects only desired rows.
I then have added a button on the sheet that shall set the filter to only rows showing "Open" in cells Kn on a click.
The strange thing is that all K cells immediately show #VALUE! as soon as I click no the button??? I can reset the K cells by a simple F2 followed by return.
I read that UDF may not enter data in cells, which is what my function does. I change the K cells to contain
=IF(=IsChangeOpen(F5;G5;H5;I5;J5)="Open";"Open";"Closed")
I thought this way the UDF does not change the cell but only help the IF to change it.
The problem still persists.
I'm out of clue what causes the #VALUE! error. Any ideas?
Thx
Peter
--------------------------------------------------------------
Function IsChangeOpen(c1, c2, c3, c4, c5) As String
Dim OpenCount
OpenCount = 0
If c1.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If c2.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If c3.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If c4.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If c5.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If OpenCount = 0 Then
IsChangeOpen = "Closed"
Else
IsChangeOpen = "Open"
End If
End Function
-----------------------------------------------------------------------
I did some research, but so far I haven't found an answer to my problem. Hopefully I can get some hints here.
I wrote the IsChangeopen() function (UDF, show futhrer down) to display "Closed" if out of 5 cells in the same row, all of them are colored (marking a complete status). If one or more cells are not colored, then "Open" shall be displayed.
I enter the functions in, say, cell K5 as =IsChangeOpen(F5;G5;H5;I5;J5). This initlally works as desired: If any of cells F5 to J5 are non-colored, then "Open" is shown in cell K5; otherwise "Closed" is shown.
I have activated auto filters, so that I can easily choose only "Open" rows to be shown. Changing the filter manually between "Open" and "all" rows works perfectly. The K cells show the desired values and the filter selects only desired rows.
I then have added a button on the sheet that shall set the filter to only rows showing "Open" in cells Kn on a click.
The strange thing is that all K cells immediately show #VALUE! as soon as I click no the button??? I can reset the K cells by a simple F2 followed by return.
I read that UDF may not enter data in cells, which is what my function does. I change the K cells to contain
=IF(=IsChangeOpen(F5;G5;H5;I5;J5)="Open";"Open";"Closed")
I thought this way the UDF does not change the cell but only help the IF to change it.
The problem still persists.
I'm out of clue what causes the #VALUE! error. Any ideas?
Thx
Peter
--------------------------------------------------------------
Function IsChangeOpen(c1, c2, c3, c4, c5) As String
Dim OpenCount
OpenCount = 0
If c1.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If c2.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If c3.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If c4.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If c5.Interior.ColorIndex = xlNone Then
OpenCount = OpenCount + 1
End If
If OpenCount = 0 Then
IsChangeOpen = "Closed"
Else
IsChangeOpen = "Open"
End If
End Function
-----------------------------------------------------------------------