Déardaoin, 05 2023 Eanáir
  1 Freagraí
  Cuairteanna 3.7K
0
Vótaí
Undo
Go raibh maith agat roimh ré as aon chabhair ar seo is féidir leat a thairiscint.

Le cabhair ón suíomh seo chruthaigh mé an fheidhm seo a leanas;

Feidhm Datha (rDath Mar Raon, Raon Mar Raon, SUM Roghnach Mar Boole)
Dim rCell Mar Raon
Dim lCol Chomh fada
Dim vToradh
lCol = rColor.Interior.ColorIndex
Má SUM = Fíor Ansin
Do Gach rCell i Raon
Má rCell.Interior.ColorIndex = lCol Ansin
vResult = Bileog OibreFunction.SUM(rCell, vResult)
Deireadh Má
An Chéad rCill eile
Eile
Do Gach rCell i Raon
Má rCell.Interior.ColorIndex = lCol Ansin
vResult = 1 + vToradh
Deireadh Má
An Chéad rCill eile
Deireadh Má
ColorFunction = vToradh
Feidhm Deireadh


I ngach spriocchill a theastaíonn uaim suim de na cealla go léir sa tsraith sin ina bhfuil dath na cille sonraithe;
= feidhm datha (AR4, H5: AP5, TRUE)

Conas is féidir liom an sprioc a dhíol a nuashonrú nuair a athraíonn aon chill eile sa tsraith (H5:AP5) dath?
1 bliain ó shin
·
#3338
0
Vótaí
Undo
Dia duit ann,

Is féidir leat an cód a chur leis: Application.Calculation = xlAutomatic le d'fheidhm:

Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult
Application.Calculation = xlAutomatic
lCol = rColor.Interior.ColorIndex
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function


Bain triail as, le do thoil.

Amanda
  • Page:
  • 1
Níl aon fhreagraí déanta don phost seo go fóill.