![]() |
Insert Border
Hi all. The below snippet of code inserts a row at a change in data
in column A, and colors the row grey. Cells(x, 4).EntireRow.Insert shift:=xlDown Cells(x, 4).Offset(0, -3).Resize(1, LastCol).Interior.ColorIndex = 15 As opposed to inserting a row, I would like to create a border. I recorded the below code with the macro recorder, but can't seem to figure out how to incorporate the variables I have in the above code! With Selection.Borders(xlEdgeBottom) .Color = -16777024 .Weight = xlThick End With I attempted this, but obviously did not work! Thanks! With Cells(x, 4) .Offset(0, -3).Resize(1, LastCol).Borders (xlEdgeBottom) .Color = -16777024 .Weight = xlThick End With |
Insert Border
Figured it out...so close yet so far away!!
With Cells(x, 4).Offset(0, -3).Resize(1, LastCol).Borders (xlEdgeBottom) .Color = -16777024 .Weight = xlThick End With On May 20, 1:31*pm, Steve wrote: Hi all. *The below snippet of code inserts a row at a change in data in column A, and colors the row grey. * * Cells(x, 4).EntireRow.Insert shift:=xlDown * * Cells(x, 4).Offset(0, -3).Resize(1, LastCol).Interior.ColorIndex = 15 As opposed to inserting a row, I would like to create a border. *I recorded the below code with the macro recorder, but can't seem to figure out how to incorporate the variables I have in the above code! * * With Selection.Borders(xlEdgeBottom) * * * * .Color = -16777024 * * * * .Weight = xlThick * * End With I attempted this, but obviously did not work! *Thanks! * * * * * * * * * * With Cells(x, 4) * * * * * * * * * * * * .Offset(0, -3).Resize(1, LastCol).Borders (xlEdgeBottom) * * * * * * * * * * * * .Color = -16777024 * * * * * * * * * * * * .Weight = xlThick * * * * * * * * * * End With |
Insert Border
Hi Steve
I'd write it this way: With Cells(x, 4).Offset(0, -3).Resize(1, LastCol) .Borders (xlEdgeBottom) .Color = -16777024 .Weight = xlThick End With I believe this form is more self-documenting with .Borders on it's own line. As you may have realized, the difference between your first and last attempt is the object that you are associating with "With" -- Clif "Steve" wrote in message ... Figured it out...so close yet so far away!! With Cells(x, 4).Offset(0, -3).Resize(1, LastCol).Borders (xlEdgeBottom) .Color = -16777024 .Weight = xlThick End With On May 20, 1:31 pm, Steve wrote: Hi all. The below snippet of code inserts a row at a change in data in column A, and colors the row grey. Cells(x, 4).EntireRow.Insert shift:=xlDown Cells(x, 4).Offset(0, -3).Resize(1, LastCol).Interior.ColorIndex = 15 As opposed to inserting a row, I would like to create a border. I recorded the below code with the macro recorder, but can't seem to figure out how to incorporate the variables I have in the above code! With Selection.Borders(xlEdgeBottom) .Color = -16777024 .Weight = xlThick End With I attempted this, but obviously did not work! Thanks! With Cells(x, 4) .Offset(0, -3).Resize(1, LastCol).Borders (xlEdgeBottom) .Color = -16777024 .Weight = xlThick End With -- Clif McIrvin (clare reads his mail with moe, nomail feeds the bit bucket :-) |
All times are GMT +1. The time now is 09:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com