Hi,
I tried your code with Autocad Mechanical 2019 and Excel 2016, inside Excel VBA development area, inserting also a user form with optionbutton, making below modification it seems to run.
I tried also to change line color and working fine cell color background on excel.
I made some modification to variable declaration.
In a first time I had some problem retrieving line Start and End points coords, later I made a modification Variable Declaration and it's running fine.
I suggest to check if the object inside "ent" variable it's really a line (perhaps could be a polyline).
Sheets(1).Activate
Dim acadApp As Object
Dim acadDoc As AcadDocument
Dim currentSelectionSet As Object
Dim ent As Object
Dim oLine As AcadLine
For your info below image with reference library in Execl Project
Finally I don't understand what do you want to do with :
If UserForm1.OptionButton2.Value = True Then
currentSelectionSet.Select acSelectionSetPrevious, , , intGroupCode, varDataCode 'This line is a problem
Else
currentSelectionSet.Select acSelectionSetAll, , , intGroupCode, varDataCode 'This line is a problem
Bye