Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Linking two "total" pages to create a "Complete Total" page Jordon Excel Worksheet Functions 0 January 10th 06 11:18 PM
Find the word "total" in a cell, delete row or column Lawlerd[_2_] Excel Programming 1 October 20th 04 02:32 PM
Find the word "total" in a cell, delete row or column Lawlerd Excel Programming 1 October 20th 04 12:02 PM
Search "Total" in all worksheets and delete rows containing "Total" mk_garg20 Excel Programming 2 July 30th 04 06:42 AM


All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"