lyonder2000
New Member
- Joined
- May 24, 2011
- Messages
- 9
Hello All,
I have a workbook that will have some raw data on about 40 worksheets. I want to clean the data up and make it look presentable. Sheet1 is unique, Sheet2 is unique, Sheet3-40 are all the same (format-wise). I've been trying to create a loop that uses a Select Case statement to determine if the Sheet is Sheet 1, 2, or other and format it accordingly.
For Each Sh In Worksheets
Select Case Sh.Name
Case Is = "QRY_OPEN_WRK_ORDRS"
Sheets("QRY_OPEN_WRK_ORDRS").Activate
Columns("A:I").Select
Selection.ColumnWidth = 19.29
Range("A1:I1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
Range("A1").Select
End With
Case Is ="QRY_TL_OPEN_WOs_by_VNDR"
Sheets("QRY_TL_OPEN_WOs_by_VNDR").Activate
Columns("B:B").EntireColumn.AutoFit
Range("A1:B1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
End With
Range("D1").Select
Case "ACCT_274201"
Columns("A:F").Select
Selection.ColumnWidth = 10.57
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("H1").Select
End Select
Next Sh
However, the first case (Case Is = "QRY_OPEN_WRK_ORDRS") formatting info is being used to format ALL the worksheets. I cannot figure out what I'm doing wrong or if I'm doing this the best way.
I have a workbook that will have some raw data on about 40 worksheets. I want to clean the data up and make it look presentable. Sheet1 is unique, Sheet2 is unique, Sheet3-40 are all the same (format-wise). I've been trying to create a loop that uses a Select Case statement to determine if the Sheet is Sheet 1, 2, or other and format it accordingly.
For Each Sh In Worksheets
Select Case Sh.Name
Case Is = "QRY_OPEN_WRK_ORDRS"
Sheets("QRY_OPEN_WRK_ORDRS").Activate
Columns("A:I").Select
Selection.ColumnWidth = 19.29
Range("A1:I1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
Range("A1").Select
End With
Case Is ="QRY_TL_OPEN_WOs_by_VNDR"
Sheets("QRY_TL_OPEN_WOs_by_VNDR").Activate
Columns("B:B").EntireColumn.AutoFit
Range("A1:B1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
End With
Range("D1").Select
Case "ACCT_274201"
Columns("A:F").Select
Selection.ColumnWidth = 10.57
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("H1").Select
End Select
Next Sh
However, the first case (Case Is = "QRY_OPEN_WRK_ORDRS") formatting info is being used to format ALL the worksheets. I cannot figure out what I'm doing wrong or if I'm doing this the best way.