\r\n\r\n
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Drawing lines to cells with VBA


\r\n \r\n
 
 
Thread Tools Display Modes

\r\n\r\n\r\n
Hi,
\r\n
\r\nI have a couple of rows (which change in numbers of rows when I use another macro) and I want to put a double line at the bottom of the last row. I used the recorder to find the beginning of my code and then I modified it for my specific needs. But it says that the method Range of the object \'_Global\' failed. I need my line to be drawn from colomn A to AE. Does anyone see where is the problem in my code?
\r\nThx!
\r\n
\r\nWerner
\r\n
\r\n
\r\n
Quote:
\r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\nSub Draw_Double_Line()
\r\n
\r\n\'Line that find the number of rows.
\r\nLet lstRw = Sheets("Formulaire").Range("a65536").End(xlUp).Row
\r\n
\r\nWith Worksheets("Formulaire")
\r\n Range("A:AE" & lstRw).Borders(xlDiagonalDown).LineStyle = xlNone
\r\n Range("A:AE" & lstRw).Borders(xlDiagonalUp).LineStyle = xlNone
\r\n Range("A:AE" & lstRw).Borders(xlEdgeLeft).LineStyle = xlNone
\r\n Range("A:AE" & lstRw).Borders(xlEdgeTop).LineStyle = xlNone
\r\n With Range("A:AE" & lstRw).Borders(xlEdgeBottom)
\r\n .LineStyle = xlDouble
\r\n .Weight = xlThick
\r\n .ColorIndex = 1
\r\n End With
\r\n Range("A:AE" & lstRw).Borders(xlEdgeRight).LineStyle = xlNone
\r\n
\r\nEnd With
\r\n
\r\nEnd Sub
\r\n \r\n
\r\n
\r\n \r\n\r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[1016955] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 06-30-2005, 12:12 PM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Werner\r\n Werner is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 06-30-2005, 10:00 AM
Werner Werner is offline
Regular
 
Join Date: Jun 2005
Location: Canada
Posts: 67
Question Drawing lines to cells with VBA


Hi,

I have a couple of rows (which change in numbers of rows when I use another macro) and I want to put a double line at the bottom of the last row. I used the recorder to find the beginning of my code and then I modified it for my specific needs. But it says that the method Range of the object '_Global' failed. I need my line to be drawn from colomn A to AE. Does anyone see where is the problem in my code?
Thx!

Werner

Quote:

Sub Draw_Double_Line()

'Line that find the number of rows.
Let lstRw = Sheets("Formulaire").Range("a65536").End(xlUp).Row

With Worksheets("Formulaire")
Range("A:AE" & lstRw).Borders(xlDiagonalDown).LineStyle = xlNone
Range("A:AE" & lstRw).Borders(xlDiagonalUp).LineStyle = xlNone
Range("A:AE" & lstRw).Borders(xlEdgeLeft).LineStyle = xlNone
Range("A:AE" & lstRw).Borders(xlEdgeTop).LineStyle = xlNone
With Range("A:AE" & lstRw).Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 1
End With
Range("A:AE" & lstRw).Borders(xlEdgeRight).LineStyle = xlNone

End With

End Sub
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->