James_Latimer
Active Member
- Joined
- Jan 20, 2009
- Messages
- 415
Win 10 / Excel 2016
Hi all,
I'm having an issue with some code whereby i seem to be unable to detect the border color of merged cells. I'm using the following code:
I'm looping through each range (Rng) in Worksheet.UsedRange but the first IF statement always returns 0.
The non-merged cells work fine but i cant get the merged cells to detect a border color of anything other than 0. oldColor and newColor are set to data type Long.
Any assistance would be sincerely appreciated. I have tried googling on the interwebs but i couldn't find a solution.
Thanks in advance!
Hi all,
I'm having an issue with some code whereby i seem to be unable to detect the border color of merged cells. I'm using the following code:
I'm looping through each range (Rng) in Worksheet.UsedRange but the first IF statement always returns 0.
Code:
If Rng.MergeCells = True Then
If Rng.MergeArea.Borders.Color = oldColor Then
Rng.MergeArea.Borders.Color = newColor
End If
Else
If Rng.Borders.Color = oldColor Then
Rng.Borders.Color = newColor
End If
End If
The non-merged cells work fine but i cant get the merged cells to detect a border color of anything other than 0. oldColor and newColor are set to data type Long.
Any assistance would be sincerely appreciated. I have tried googling on the interwebs but i couldn't find a solution.
Thanks in advance!