View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JP[_3_] JP[_3_] is offline
external usenet poster
 
Posts: 168
Default Trying to clean up code that I did through a record macro

Hi Bob,

Try this instead:

Sub ColorColumnHeaders()

Set X = Range("A1, B1, C1") 'or whatever the cells you want to
operate on
X.Interior.ColorIndex = 3
X.HorizontalAlignment = xlCenter

' put some more code here

Set X = Nothing

End Sub


Hope this helps,
JP

On Oct 5, 6:53 pm, "LabrGuy Bob R" wrote:
Hello, Excel 2003 and I've recorded a macro to activate a worksheet and then
activate specific cells and format them with color, font, and alignment. The
code from the macro isquite large and I know wasteful. Could someone help me
with this to make it cleaner and do what I want? All of these cells are
located in a Pivot table that I have already established with code.


Any help would be appreciated Thanks
BOB