robertmwaring2
Board Regular
- Joined
- Mar 8, 2019
- Messages
- 132
- Office Version
- 365
- Platform
- Windows
Hello again everyone, hate to be so annoying, but I really am trying. I have come across another issue I can't seem to resolve. I have a worksheet ("Production Sheet") that has 5 columns of information ranging from "A:J". The the first column, the information is centered across Selection from "A:D", the secong column is "E", the third is "F", the fourth "G:I", and the ifith "J". I have the following code to accomplish the formatting for the first Column ("A:D"):
Dim lRow As Long
lRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("A8:D" & lRow).Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = True
.ReadingOrder = xlContext
.MergeCells = False
End With
Currently, the fourth column is not merged or centered, but I need it to be ONLY if the row in Coulmn A is not blank(no formulas in the cell). The data begins on Row 8 and will not have blanks in the middle of the range.
So, to be clear, if A8 <>"", i need to MERGE (not center across selection) columns G:I on that row (8)
and loop down for each row after that until if finds a blank cell in Column A - then stop.
I tried to alter the code above, but it merges the entire range from G8:G(whatever) together into one cell - which is close, but not what I need. Can anyone help me please?
Dim lRow As Long
lRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("A8:D" & lRow).Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = True
.ReadingOrder = xlContext
.MergeCells = False
End With
Currently, the fourth column is not merged or centered, but I need it to be ONLY if the row in Coulmn A is not blank(no formulas in the cell). The data begins on Row 8 and will not have blanks in the middle of the range.
So, to be clear, if A8 <>"", i need to MERGE (not center across selection) columns G:I on that row (8)
and loop down for each row after that until if finds a blank cell in Column A - then stop.
I tried to alter the code above, but it merges the entire range from G8:G(whatever) together into one cell - which is close, but not what I need. Can anyone help me please?