Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last row, add "Total" in col B & border
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last row, add "Total" in col B & border
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" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last row, add "Total" in col B & border
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" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last row, add "Total" in col B & border
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 -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=378246 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last row, add "Total" in col B & border
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" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Linking two "total" pages to create a "Complete Total" page | Excel Worksheet Functions | |||
Find the word "total" in a cell, delete row or column | Excel Programming | |||
Find the word "total" in a cell, delete row or column | Excel Programming | |||
Search "Total" in all worksheets and delete rows containing "Total" | Excel Programming |