on-internet
← Community

How to copy font and interior color from one multi-cell range to another?

Stack Overflow ·

I have a range with several cells, and I want to copy that range's font colors and interior colors to another range of the same size. I'm using this code to test: Sub testColorCopy() Dim sht As Worksheet Dim rng As Range Dim rng2 As Range Set sht = ThisWorkbook.Sheets("Sheet1") sht.Range("a1").value = "abc" sht.Range("c1").value = "def" sht.Range("a1").Font.ColorIndex = 3 sht.Range("b1").Interior.ColorIndex = 4 Set rng = sht.Range("a1:b1") Set rng2 = sht.Range("c1:d1") rng2.Interior.color = rng.Interior.color rng2.Font.color = rng.Font.color End Sub This doesn't copy the correct colors, though

Comments

Sign in or sign up to comment and upvote.

No comments yet.