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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
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,215,003
Messages
6,122,655
Members
449,091
Latest member
peppernaut

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