'Count conditionally formatted cells in each row until last row
I found this working solution to count conditionally formatted cells:
Sub CountColorCellsAQ3()
'Variable declaration
Dim rng As Range
Dim lColorCounter As Long
Dim rngCell As Range
'Set the range of cells to count
Set rng = Sheet2.Range("B2:Y2")
'loop throught each cell in the range
For Each rngCell In rng
'Checking Red color
If Cells(rngCell.Row, rngCell.Column).DisplayFormat.Interior.Color = RGB(198, 224, 180) Then
lColorCounter = lColorCounter + 1
End If
Next
'Display the total number of red cells in cell listed below
ActiveSheet.Range("AB2") = lColorCounter
End Sub
It works only for one row and writes a result to one predefined cell.
How can I count formatted cells (range will be the same, but in different row) in every row till last row and put result near every row in dedicated Result column.
Every row is a different person, so I need to count colored cells for each person individually.
Solution 1:[1]
if(Input.GetKeyUp("f")){
transform.position = ship1.transform.position;
}
Sidenote, you can't assign values to only one component of a vector. You need to reassign the entire vector with the new component or add/subtract to the original vector. Your script should look like
if (Input.GetKey("f"))
{
Vector3 pos = transform.position;
if (Input.mousePosition.y >= Screen.height - panBorderThickness)
{
pos += new Vector3(0, panspeed * Time.deltaTime, 0);
}
if (Input.mousePosition.y <= panBorderThickness)
{
pos -= new Vector3(0, panspeed * Time.deltaTime, 0);
}
if (Input.mousePosition.x >= Screen.width - panBorderThickness)
{
pos += new Vector3(panspeed * Time.deltaTime, 0, 0);
}
if (Input.mousePosition.x <= panBorderThickness)
{
pos -= new Vector3(panspeed * Time.deltaTime, 0, 0);
}
transform.position = pos;
}
if(Input.GetKeyUp("f"))
{
transform.position = GameObjectYouWant.transform.position;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | bnzzy |
