![]() |
code for changing font
Hi all,
With the code below I want to change all red Wide Latin text in range A2:F100 into black, bold (in my Dutch version the word for "bold" is "vet"), Times New Roman. It will not work at all. What's wrong? Jack Sons The Netherlands ------------------------------------------------------------------------------------ Sub Change() Dim rng As Range Dim rCell As Range Set rng = Range("A2:F100") For Each rCell In rng.Cells With rCell If .Font.Name = "Wide Latin" Then .Font.Name = "Times New Roman" .Font.ColorIndex = 1 .FontStyle = "vet" End If End With Next rCell End Sub |
code for changing font
Try using something like:
..Font.Bold = True -- Gary's Student "Jack Sons" wrote: Hi all, With the code below I want to change all red Wide Latin text in range A2:F100 into black, bold (in my Dutch version the word for "bold" is "vet"), Times New Roman. It will not work at all. What's wrong? Jack Sons The Netherlands ------------------------------------------------------------------------------------ Sub Change() Dim rng As Range Dim rCell As Range Set rng = Range("A2:F100") For Each rCell In rng.Cells With rCell If .Font.Name = "Wide Latin" Then .Font.Name = "Times New Roman" .Font.ColorIndex = 1 .FontStyle = "vet" End If End With Next rCell End Sub |
code for changing font
That's it, thanks.
Jack. "Gary''s Student" schreef in bericht ... Try using something like: .Font.Bold = True -- Gary's Student "Jack Sons" wrote: Hi all, With the code below I want to change all red Wide Latin text in range A2:F100 into black, bold (in my Dutch version the word for "bold" is "vet"), Times New Roman. It will not work at all. What's wrong? Jack Sons The Netherlands ------------------------------------------------------------------------------------ Sub Change() Dim rng As Range Dim rCell As Range Set rng = Range("A2:F100") For Each rCell In rng.Cells With rCell If .Font.Name = "Wide Latin" Then .Font.Name = "Times New Roman" .Font.ColorIndex = 1 .FontStyle = "vet" End If End With Next rCell End Sub |
All times are GMT +1. The time now is 11:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com