I'm a super noob to VBA and programming in general. I have a column A starting at A3 down to last filled cell which I want to format with font Trebuchet, Regular, 9 using VBA (Learning macro doesn't cut it for me any more) TIA John
I'm a super noob to VBA and programming in general. I have a column A starting at A3 down to last filled cell which I want to format with font Trebuchet, Regular, 9 using VBA (Learning macro doesn't cut it for me any more) TIA John
Hello John,
Now, now. Don't give up yet!Learning macro doesn't cut it for me any more
Try this:-
You may have to change the sheet name to suit. I've used the sheet code above.Please Login or Register to view this content.
I hope that this helps.
Cheerio,
vcoolio.
It has. Thanks.
Can I expand it thus:
Sub FormatA()
Dim lr As Long: lr = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
With Sheet1.Range("A3:A" & lr).Font
.Name = "Trebuchet"
.FontStyle = "Regular"
.Size = 9
.HorizontalAlignment = xlCenter
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
End Sub
or maybe:
Sub FormatA()
Dim lr As Long: lr = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
With Sheet1.Range("A3:A" & lr).Font
.Name = "Trebuchet"
.FontStyle = "Regular"
.Size = 9
.HorizontalAlignment = xlCenter
.Borders (xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
End Sub
Hello John,
See you haven't given up yet!
Almost. They're all different properties so hence need to be treated separately:-
Cheerio,Please Login or Register to view this content.
vcoolio.
OK I see I've learned a lot.
Thanks
Last edited by JohnHedge; 04-04-2019 at 01:05 AM.
You're welcome John.
I'm glad to have been able to assist you.
Cheerio,
vcoolio.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks