Macro to create think outside border where last cells appears

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,568
Office Version
  1. 2021
Platform
  1. Windows
I have a macro to total data and then to insert a thick outside border around the last row containing data in Col A & B

The macro is totalling the data correctly, but I get an error pertaining to the code to create a thick outside border

Kindly check & amend my code


Code:
 Sub Total()
Dim finalrow As Long
With Sheets("Sales Data")
finalrow = Cells(Rows.Count, "A").End(xlUp).Row
.Range("A" & finalrow + 3).Value = "Total Maturities"
.Range("B" & finalrow + 3) = "=sum(B2:B" & finalrow & ")"
.Range("A" & finalrow + 3).Resize(, 2).Font.bold = True
.Range("A" & finalrow + 3).Resize(, 2).Borders.LineStyle = xlContinuous

.Weight = xlThick
End With


End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
That .Weight = xlThick is under With Sheets("Sales Data")

Should be .Range("A" & finalrow + 3).Resize(, 2).Borders.Weight = xlThick
 
Upvote 0

Forum statistics

Threads
1,215,767
Messages
6,126,766
Members
449,336
Latest member
p17tootie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top