Sandy Radjenovic
Board Regular
- Joined
- Nov 4, 2003
- Messages
- 76
I have a workbook with seven identical worksheets (each holding a schedule for a particular machine). I have a macro that runs and reformats the columns. I would like to name the column ranges so that if a column is added or deleted, I do not have to rename the columns selected in formatcolumns(). Is it possible to do this? Can I have identical named ranges on all of the worksheets (i.e. column A = status, column B= job, etc.)? I have tried this and have noted that if I define a named ranged in worksheet 2 that I had already set in worksheet 1, worksheet 1's named range no longer exists. Is there some way to do this?
I'd really appreciate some insight.
Sub FormatColumns()
Application.ScreenUpdating = False
Range("status").Select
'Columns("A:A").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
.ColumnWidth = 11.5
End With
... commands exist after this code for rest of columns
End Sub
I'd really appreciate some insight.
Sub FormatColumns()
Application.ScreenUpdating = False
Range("status").Select
'Columns("A:A").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
.ColumnWidth = 11.5
End With
... commands exist after this code for rest of columns
End Sub