• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Trouble with If Then Macro and Alignment Macro

skidragon02

New Member
Hello, I am trying to do two things:


-make cells L3 to L183 appear blank if the given value is "N"

-make cells G3 to G183 Left Justified


How would I add that to the following macro?

**NOTE: All of these cells already have formulas to give me this information, but I still need to alter the formatting**

[pre]
Code:
Sub Column_Widths()

Dim ws As Worksheet
Application.ScreenUpdating = False
For i = 5 To 39
With Sheets(i)
.Columns("A:A").ColumnWidth = 5.57
.Columns("B:B").ColumnWidth = 11.71
.Columns("C:C").ColumnWidth = 8.86
.Columns("D:D").ColumnWidth = 8.86
.Columns("E:E").ColumnWidth = 9.43
.Columns("F:F").ColumnWidth = 2.86
.Columns("G:G").ColumnWidth = 17#
.Columns("H:H").ColumnWidth = 7.29
.Columns("I:I").ColumnWidth = 32#
.Columns("J:J").ColumnWidth = 32#
.Columns("K:K").ColumnWidth = 16.29
.Columns("L:L").ColumnWidth = 7.71
.Columns("M:M").ColumnWidth = 10.29
.Columns("N:N").ColumnWidth = 4.86
.Columns("O:O").ColumnWidth = 7.14
.Columns("P:P").ColumnWidth = 4.86
.Columns("Q:Q").ColumnWidth = 6.29
.Columns("R:R").ColumnWidth = 5.57
.Rows("3:183").EntireRow.AutoFit
End With
Next
Application.ScreenUpdating = True
End Sub
[/pre]
Thanks in advance for the help!
 
Probably the easiest way would be to record a macro of you select the applicable ranges and doing a left alignment and adding the Conditional Format. Should be fairly straight-forward. Just ned to add the code before the
Code:
End With
 
Back
Top