Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell formatting code
Hi All
The code below works fine. But, as you can see it was from a recorded macro, apart from the first line. Is it possible to make this code "cleaner" by removing excess code. I have tried to make some changes but keep getting errors. Any assistance would be appreciated. Regards Michael M With range("E17:G" & lrow + 2) .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .Font.Size = 10 .NumberFormat = "#,##0.00" End With With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell formatting code
One way:
With Range("E17:G" & lrow + 2) .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .Font.Size = 10 .NumberFormat = "#,##0.00" With .Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With .Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With End With In article , Michael M wrote: Hi All The code below works fine. But, as you can see it was from a recorded macro, apart from the first line. Is it possible to make this code "cleaner" by removing excess code. I have tried to make some changes but keep getting errors. Any assistance would be appreciated. Regards Michael M With range("E17:G" & lrow + 2) .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .Font.Size = 10 .NumberFormat = "#,##0.00" End With With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
conditional formatting w/ more than 3 conditionas, color code to a different cell | About this forum | |||
Zip Code Formatting | New Users to Excel | |||
Zip Code Formatting | Excel Programming | |||
Formatting a cell in Excel, using pure VB code | Excel Programming |