mperrah
09-04-2007, 10:46 AM
fyi:
I wrote this code to find the last cell in column b,
then select across to column AK (35 columns)
and add a thin border to the bottom.
The column B has no blank spaces.
I found most of the coding here at vbaexpress. Thank you..
One question:
I saw a code that resizes the selection a specified number,
Selection.Offest(-1,0).Resize(Selection.Rows.Count+1).Select
I could not get it to work. This code works but was interested to use the number of columns instead of hard coding a column name...
Sub addbordertolastrowB()
Dim LastRowB As Long
With Range("$B:$B")
LastRowB = .Cells(.Rows.Count, 1).End(xlUp).Row
End With
Range("B" & LastRowB & ":AK" & LastRowB).Select
' selection.offset(0, 0).resize(Selection.columns.count+35).select < this is an attempt
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
End With
Range("B" & LastRowB).Select
End Sub
I wrote this code to find the last cell in column b,
then select across to column AK (35 columns)
and add a thin border to the bottom.
The column B has no blank spaces.
I found most of the coding here at vbaexpress. Thank you..
One question:
I saw a code that resizes the selection a specified number,
Selection.Offest(-1,0).Resize(Selection.Rows.Count+1).Select
I could not get it to work. This code works but was interested to use the number of columns instead of hard coding a column name...
Sub addbordertolastrowB()
Dim LastRowB As Long
With Range("$B:$B")
LastRowB = .Cells(.Rows.Count, 1).End(xlUp).Row
End With
Range("B" & LastRowB & ":AK" & LastRowB).Select
' selection.offset(0, 0).resize(Selection.columns.count+35).select < this is an attempt
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
End With
Range("B" & LastRowB).Select
End Sub