I want to find the last row in a worksheet, then add the text "Total" under
column B, and add a border from column C thru O:
..Borders(xlEdgeBottom)
..LineStyle = xlDouble
How can I select the range?
-Agnes
I want to find the last row in a worksheet, then add the text "Total" under
column B, and add a border from column C thru O:
..Borders(xlEdgeBottom)
..LineStyle = xlDouble
How can I select the range?
-Agnes
Hello Agnes,
The folowing code will help you select the range you want.
Dim LastRow As Long
Dim BlankRow As Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
BlankRow = LastRow + 1
Cells(BlankRow, "B").Value = "Total"
With Range(Cells(BlankRow, "C"), Cells(BlankRow, "O"))
.Select
.Borders(xlEdgeBottom)
.LineStyle = xlDouble
End With
Sincerely,
Leith Ross
Hi AGnes,
Try:
Sub Tester()
Dim LRow As Long
Dim Rng As Range
LRow = _
Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
Cells(LRow + 1, "B").Value = "Total"
Set Rng = Range(Cells(LRow + 1, "C"), _
Cells(LRow + 1, "O"))
With Rng.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.ColorIndex = xlAutomatic
End With
End Sub
---
Regards,
Norman
"AGnes" <[email protected]> wrote in message
news:[email protected]...
>I want to find the last row in a worksheet, then add the text "Total" under
> column B, and add a border from column C thru O:
>
> .Borders(xlEdgeBottom)
> .LineStyle = xlDouble
>
> How can I select the range?
>
> -Agnes
It works! Thanks for your help.
-Agnes
"Norman Jones" wrote:
> Hi AGnes,
>
> Try:
>
> Sub Tester()
> Dim LRow As Long
> Dim Rng As Range
>
> LRow = _
> Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
>
> Cells(LRow + 1, "B").Value = "Total"
> Set Rng = Range(Cells(LRow + 1, "C"), _
> Cells(LRow + 1, "O"))
>
> With Rng.Borders(xlEdgeBottom)
> .LineStyle = xlDouble
> .ColorIndex = xlAutomatic
> End With
> End Sub
>
> ---
> Regards,
> Norman
>
>
>
> "AGnes" <[email protected]> wrote in message
> news:[email protected]...
> >I want to find the last row in a worksheet, then add the text "Total" under
> > column B, and add a border from column C thru O:
> >
> > .Borders(xlEdgeBottom)
> > .LineStyle = xlDouble
> >
> > How can I select the range?
> >
> > -Agnes
>
>
>
How is this?
With [B65536].End(xlUp).Offset(1, 0)
.Value = "Total"
.Offset(0, 1).Resize(1, 13).Borders(xlEdgeBottom).Color = RGB(255, 0, 0)
.Offset(0, 1).Resize(1, 13).Borders.LineStyle = xlDouble
End With
Regards
Robert McCurdy
"AGnes" <[email protected]> wrote in message news:[email protected]...
I want to find the last row in a worksheet, then add the text "Total" under
column B, and add a border from column C thru O:
..Borders(xlEdgeBottom)
..LineStyle = xlDouble
How can I select the range?
-Agnes
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks