J
jmartinez.pincheira
Hi everyone, this is my first post. I would appreciate it if you tell
me how to do this in a more "elegant" way. I imagine that exist a more
sinthetic form to do this without specifying the range every time.
r is set previously in the code
With xlsheet
.Range(.Cells(r, 1), .Cells(r, 4)).MergeCells = True
.Range(.Cells(r, 1), .Cells(r, 4)).HorizontalAlignment = xlCenter
.Range(.Cells(r, 1), .Cells(r, 4)).VerticalAlignment = xlCenter
.Range(.Cells(r, 1), .Cells(r, 4)).Interior.ColorIndex = 53
.Range(.Cells(r, 1), .Cells(r, 4)).Interior.Pattern = xlSolid
.Range(.Cells(r, 1), .Cells(r, 4)).Font.Size = 8
.Range(.Cells(r, 1), .Cells(r, 4)).Font.ColorIndex = 2
.Range(.Cells(r, 1), .Cells(r, 4)).Value = "label1"
.Range(.Cells(r, 5), .Cells(r, 6)).MergeCells = True
.Range(.Cells(r, 5), .Cells(r, 6)).HorizontalAlignment = xlCenter
.Range(.Cells(r, 5), .Cells(r, 6)).VerticalAlignment = xlCenter
.Range(.Cells(r, 5), .Cells(r, 6)).Interior.ColorIndex = 53
.Range(.Cells(r, 5), .Cells(r, 6)).Interior.Pattern = xlSolid
.Range(.Cells(r, 5), .Cells(r, 6)).Font.Size = 8
.Range(.Cells(r, 5), .Cells(r, 6)).Font.ColorIndex = 2
.Range(.Cells(r, 5), .Cells(r, 6)).Value = "label2"
.Range(.Cells(r, 7), .Cells(r, 8)).MergeCells = True
.Range(.Cells(r, 7), .Cells(r, 8)).HorizontalAlignment = xlCenter
.Range(.Cells(r, 7), .Cells(r, 8)).VerticalAlignment = xlCenter
.Range(.Cells(r, 7), .Cells(r, 8)).Interior.ColorIndex = 53
.Range(.Cells(r, 7), .Cells(r, 8)).Interior.Pattern = xlSolid
.Range(.Cells(r, 7), .Cells(r, 8)).Font.Size = 8
.Range(.Cells(r, 7), .Cells(r, 8)).Font.ColorIndex = 2
.Range(.Cells(r, 7), .Cells(r, 8)).Value = "label3"
End With
Thanks
Javier Martinez
me how to do this in a more "elegant" way. I imagine that exist a more
sinthetic form to do this without specifying the range every time.
r is set previously in the code
With xlsheet
.Range(.Cells(r, 1), .Cells(r, 4)).MergeCells = True
.Range(.Cells(r, 1), .Cells(r, 4)).HorizontalAlignment = xlCenter
.Range(.Cells(r, 1), .Cells(r, 4)).VerticalAlignment = xlCenter
.Range(.Cells(r, 1), .Cells(r, 4)).Interior.ColorIndex = 53
.Range(.Cells(r, 1), .Cells(r, 4)).Interior.Pattern = xlSolid
.Range(.Cells(r, 1), .Cells(r, 4)).Font.Size = 8
.Range(.Cells(r, 1), .Cells(r, 4)).Font.ColorIndex = 2
.Range(.Cells(r, 1), .Cells(r, 4)).Value = "label1"
.Range(.Cells(r, 5), .Cells(r, 6)).MergeCells = True
.Range(.Cells(r, 5), .Cells(r, 6)).HorizontalAlignment = xlCenter
.Range(.Cells(r, 5), .Cells(r, 6)).VerticalAlignment = xlCenter
.Range(.Cells(r, 5), .Cells(r, 6)).Interior.ColorIndex = 53
.Range(.Cells(r, 5), .Cells(r, 6)).Interior.Pattern = xlSolid
.Range(.Cells(r, 5), .Cells(r, 6)).Font.Size = 8
.Range(.Cells(r, 5), .Cells(r, 6)).Font.ColorIndex = 2
.Range(.Cells(r, 5), .Cells(r, 6)).Value = "label2"
.Range(.Cells(r, 7), .Cells(r, 8)).MergeCells = True
.Range(.Cells(r, 7), .Cells(r, 8)).HorizontalAlignment = xlCenter
.Range(.Cells(r, 7), .Cells(r, 8)).VerticalAlignment = xlCenter
.Range(.Cells(r, 7), .Cells(r, 8)).Interior.ColorIndex = 53
.Range(.Cells(r, 7), .Cells(r, 8)).Interior.Pattern = xlSolid
.Range(.Cells(r, 7), .Cells(r, 8)).Font.Size = 8
.Range(.Cells(r, 7), .Cells(r, 8)).Font.ColorIndex = 2
.Range(.Cells(r, 7), .Cells(r, 8)).Value = "label3"
End With
Thanks
Javier Martinez