View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
mevetts[_6_] mevetts[_6_] is offline
external usenet poster
 
Posts: 1
Default Macro for new column


Here is the macro I have so far created -

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 29/11/2005 by M.Evetts
'

'
Selection.EntireColumn.Insert
Selection.EntireColumn.Insert
Range("Z4:Z9").Select
With Selection
..VerticalAlignment = xlBottom
..WrapText = False
..Orientation = 90
..AddIndent = False
..ShrinkToFit = False
..ReadingOrder = xlContext
..MergeCells = True
End With
Range("Y4:Y9").Select
With Selection
..VerticalAlignment = xlBottom
..WrapText = False
..Orientation = 90
..AddIndent = False
..ShrinkToFit = False
..ReadingOrder = xlContext
..MergeCells = True
End With
ActiveWindow.SmallScroll Down:=9
Range("Z23:Z28").Select
With Selection
..VerticalAlignment = xlBottom
..WrapText = False
..AddIndent = False
..ShrinkToFit = False
..ReadingOrder = xlContext
..MergeCells = True
End With
Range("Y23:Y28").Select
With Selection
..VerticalAlignment = xlBottom
..WrapText = False
..AddIndent = False
..ShrinkToFit = False
..ReadingOrder = xlContext
..MergeCells = True
End With
Range("Z23:Z39").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
With Selection.Borders(xlEdgeRight)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With
ActiveWindow.SmallScroll Down:=-27
Range("B1").Select
End Sub


It does insert the new columns whichever cell is active, however, it it
does not apply the formatting to the newly inserted columns. Instead, it
keeps formatting the cells that where formatted during the recording of
the macro.

Is there any way of getting it so that it formats the cells in the
newly inserted columns?

Many thanks,

Mark.


--
mevetts


------------------------------------------------------------------------
mevetts's Profile: http://www.excelforum.com/member.php...o&userid=29130
View this thread: http://www.excelforum.com/showthread...hreadid=488798