@Jeovany CV
Thanks for your nicely documented reply. You have have posted before I added to my post that I had succeeded in put the code into ThisWorkbook. The code is running now, but it gets an error on
Range("VendorNameFirst", "VendorNameLast").Insert _
Shift:=xlShiftDown
Please see my post
https://answers.microsoft.com/en-us/msoffice/forum/all/use-vba-rangeinsert-method-with-excel-defined-name/1ac37592-f1a3-4538-a9e1-cbf750939990
Private Sub Workbook_Open()
Stop 'for debugging '7-5-2020
onerrorsw = 0
On Error GoTo OnErrorRoutineInOpen
NORMAL_OPEN:
Stop '7-5-2020 uncommnent this for debugging
' click Run to continue in normal mode
' click Debug to start debug mode
'Stop 'for debugging
openCount = openCount + 1
Range("VendorNameFirst", "VendorNameLast").Insert _
Shift:=xlShiftDown
OnErrorRoutineInOpen:
Stop
Debug.Print "In Open ERROR " & Err.Number & " SOURCE " & Err.Source
On Error GoTo 0
Stop
Resume Next
' says "Resume without error"
Stop
End Sub
It gets the error on
Range("VendorNameFirst", "VendorNameLast").Insert _
Shift:=xlShiftDown
The error must be in the syntax, but how to find what's wrong with the syntax.
The article at https://docs.microsoft.com/en-us/office/vba/api/excel.range.insert doesn't say how to use defined-names
for the range.