ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Putting a Border On a Partial Row (https://www.excelbanter.com/excel-programming/281771-putting-border-partial-row.html)

Normajm

Putting a Border On a Partial Row
 
Here is some code I wrote to put a border at the bottom of a list of numbers, but above the totaling functions and text I don't know how to go to the bottom of column G, then down 1 row, then select the cells from there left across to column M. The number of rows in the table will change from one time to the next, but the number of columns will not. Any help would be appreciated. I've used Excel for a number of years, but haven't had a need to do programming until now.


Private Sub btnSummary_Click()
ActiveSheet.Range("L7").End(xlDown).Offset(1, 0).Formula = "TOTAL"
ActiveSheet.Range("L7").End(xlDown).Offset(0, 0).HorizontalAlignment = xlRight
ActiveSheet.Range("M7").End(xlDown).Offset(1, 0).FormulaR1C1 = "=Sum(R2C:R[-1]C)"
ActiveSheet.Range("L7").End(xlDown).Offset(1, 0).Formula = "Total Times 71.25%"
ActiveSheet.Range("L7").End(xlDown).Offset(0, 0).HorizontalAlignment = xlRight
ActiveSheet.Range("M7").End(xlDown).Offset(1, 0).FormulaR1C1 = "=.7125*(R[-1]C)"
Range("G7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("H7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("I7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("J7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("K7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("L7").End(xlDown).Offset(-1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("M7").End(xlDown).Offset(-1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("G8").Select

End Sub

Tom Ogilvy

Putting a Border On a Partial Row
 
Activesheet.Range("G7").End(xldown).Offset(1,0).Re size(1,7).Select

--
Regards,
Tom Ogilvy

"Normajm" wrote in message
...
Here is some code I wrote to put a border at the bottom of a list of

numbers, but above the totaling functions and text I don't know how to go
to the bottom of column G, then down 1 row, then select the cells from there
left across to column M. The number of rows in the table will change from
one time to the next, but the number of columns will not. Any help would be
appreciated. I've used Excel for a number of years, but haven't had a need
to do programming until now.


Private Sub btnSummary_Click()
ActiveSheet.Range("L7").End(xlDown).Offset(1, 0).Formula = "TOTAL"
ActiveSheet.Range("L7").End(xlDown).Offset(0, 0).HorizontalAlignment =

xlRight
ActiveSheet.Range("M7").End(xlDown).Offset(1, 0).FormulaR1C1 =

"=Sum(R2C:R[-1]C)"
ActiveSheet.Range("L7").End(xlDown).Offset(1, 0).Formula = "Total Times

71.25%"
ActiveSheet.Range("L7").End(xlDown).Offset(0, 0).HorizontalAlignment =

xlRight
ActiveSheet.Range("M7").End(xlDown).Offset(1, 0).FormulaR1C1 =

"=.7125*(R[-1]C)"
Range("G7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("H7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("I7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("J7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("K7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("L7").End(xlDown).Offset(-1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("M7").End(xlDown).Offset(-1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("G8").Select

End Sub




Normajm[_2_]

Putting a Border On a Partial Row
 
Thank you. I've been learning so much here by reading
other people's questions and the replies to them. Keep up
the good work.

-----Original Message-----
Activesheet.Range("G7").End(xldown).Offset(1,0).R esize

(1,7).Select

--
Regards,
Tom Ogilvy

"Normajm" wrote in message
...
Here is some code I wrote to put a border at the bottom

of a list of
numbers, but above the totaling functions and text I

don't know how to go
to the bottom of column G, then down 1 row, then select

the cells from there
left across to column M. The number of rows in the table

will change from
one time to the next, but the number of columns will

not. Any help would be
appreciated. I've used Excel for a number of years, but

haven't had a need
to do programming until now.


Private Sub btnSummary_Click()
ActiveSheet.Range("L7").End(xlDown).Offset(1,

0).Formula = "TOTAL"
ActiveSheet.Range("L7").End(xlDown).Offset(0,

0).HorizontalAlignment =
xlRight
ActiveSheet.Range("M7").End(xlDown).Offset(1,

0).FormulaR1C1 =
"=Sum(R2C:R[-1]C)"
ActiveSheet.Range("L7").End(xlDown).Offset(1,

0).Formula = "Total Times
71.25%"
ActiveSheet.Range("L7").End(xlDown).Offset(0,

0).HorizontalAlignment =
xlRight
ActiveSheet.Range("M7").End(xlDown).Offset(1,

0).FormulaR1C1 =
"=.7125*(R[-1]C)"
Range("G7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("H7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("I7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("J7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("K7").End(xlDown).Offset(1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("L7").End(xlDown).Offset(-1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("M7").End(xlDown).Offset(-1, 0).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("G8").Select

End Sub



.



All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com