LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 118
Default Format Cells by code

Hi All
The code below works fine, but I would like to simplify it.
As you can tell it is recorded code except for the cell ranges.
Any assistance in shortening the code would be appreciated, if only to
improve my knowledge !!!

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
For Each c In range("H17:H" & lrow + 2)
With c.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Next
For Each c In range("C17:C" & lrow + 2)
With Selection
.Borders(xlEdgeLeft).LineStyle = xlNone
End With
Next


Regards
Michael M
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
NAICS Code Cell Format [email protected] Excel Discussion (Misc queries) 3 March 3rd 07 04:29 AM
date format in code TUNGANA KURMA RAJU Excel Discussion (Misc queries) 2 December 26th 05 03:42 AM
Time code cell format pauls510 Excel Worksheet Functions 1 November 24th 05 05:53 PM
Code for Conditional format TUNGANA KURMA RAJU Excel Discussion (Misc queries) 4 November 3rd 05 09:58 AM
zip code format Rachel Excel Discussion (Misc queries) 1 January 11th 05 07:57 PM


All times are GMT +1. The time now is 06:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"