BertyBerts
New Member
- Joined
- May 5, 2018
- Messages
- 2
Hi,
I have the following code that checks for a condition in the range, and ifit is a ‘1’ then it select some cells and formats them (by changing theinterior colour, interior.ThemeColor and Font.ThemeColor).
The problem is that, as the program loops through so many cells, itselects many – prior to making the changes – and the macro is very very slow.
I’m looking either (1) for a way to avoid the cell selection* but use thesame basic principle or (2) alternative way all together.
* I’ve found that I can do StatusMarker.Offset(0, 6).Interior.Color =5296274 but this method doesn’t work with the ThemeColour requirements.
The macro’s far too slow and any help will be really appreciated – codebelow:
I have the following code that checks for a condition in the range, and ifit is a ‘1’ then it select some cells and formats them (by changing theinterior colour, interior.ThemeColor and Font.ThemeColor).
The problem is that, as the program loops through so many cells, itselects many – prior to making the changes – and the macro is very very slow.
I’m looking either (1) for a way to avoid the cell selection* but use thesame basic principle or (2) alternative way all together.
* I’ve found that I can do StatusMarker.Offset(0, 6).Interior.Color =5296274 but this method doesn’t work with the ThemeColour requirements.
The macro’s far too slow and any help will be really appreciated – codebelow:
Code:
'Count Number of Green Ticks and Record
'If Green Tick in Completed Column)Green Each Process Stream DescriptionCell/Grey Time Columns
'1st Process Stream
'Set Counters
y = 0
z = 0
For Each StatusMarker In StatusTimeSpan
If StatusMarker.Offset(0, 5) = 1 Then
y = y + 1 'MsgBox x
StatusMarker.Offset(0, 6).Select
Selection.Interior.Color = 5296274
Range(StatusMarker.Offset(0, 2), StatusMarker.Offset(0, 4)).Select
Selection.Interior.ThemeColor = xlThemeColorDark2
Selection.Font.ThemeColor = xlThemeColorDark2
End If
Next StatusMarker 'MsgBox x
Sheets("Data").Range("B8").Value = y
Last edited by a moderator: