Runtime error 1004 unable to set the weight property of the border class

AJZLindsay93

New Member
Joined
Mar 12, 2019
Messages
3
Hello All,

I am attempting to insert N number of rows based on N being inserted in cell "D7"

Rows are to be inserted at A10, with the formatting (borders) extending to D10

This is the code i have so far but I keep getting the error message "Runtime error 1004 unable to set the weight property of the border class"

Private Sub Worksheet_Change(ByVal Target As Range)
Dim N As Long
If Not Intersect(Target, Me.Range("D7")) Is Nothing Then
With Me
N = .Range("D7").Value2
With .Range("A10:D10").Resize(N)
.Borders.Weight = X1Medium
.Borders.LineStyle = xlContinous
End With
End With
End If
End Sub


Any help would be greatly appreciated
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I think you have a type here:
Code:
[COLOR=#333333].Borders.Weight = X1Medium[/COLOR]
I believe it should be "xlMedium", not "x1Medium" (the second character should be the lower case letter "L", not the number "1").
 
Upvote 0

Forum statistics

Threads
1,223,155
Messages
6,170,403
Members
452,325
Latest member
BlahQz

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