User-Defined Type Not Defined

James_Latimer

Active Member
Joined
Jan 20, 2009
Messages
415
Excel 2010

Hello,
I'm hoping someone can give me a little assistance please.....

I have an xlsm file which seemed to be working fine. I have since recorded a macro for sorting columns descendingly and amended the code putting it into the activate code of one of the sheets.

The code is.....
Code:
Private Sub Worksheet_Activate()
    Sheets("D2").Sort.SortFields.Clear
    Sheets("D2").Sort.SortFields.Add Key:=Range("E6:E8"), _
        SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    With Sheets("D2").Sort
        .SetRange Range("B6:E8")
        .Header = xlNo
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply

    End With
End Sub

The issue i have now is that whenever i type into a cell and hit return i am getting a message "User-defined type not defined". I'm not sure why. I've had a look at other posts and it all seems to be down to references (i cant see any that are missing or unchecked that should be - dont quote me on that!!).

This works fine in excel 2007 though.

If anyone can point me in the right direction it would be much appreciated.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Done that and the same.

I find the only time i get this error is when using the Return key. If i select a cell, type something into the formula bar and then mouse click onto another cell then the cell is populated and i dont get an error.

Something to do with the return key (somehow).

I'm going to find a dark corner to cry in for a little while :(
 
Upvote 0
Maybe another thing to consider,

Do you have any Add-Ins Installed? Excel 2007 go to Excel Options and then Add-Ins and Manage Add-Ins. The installed ones are the ones with a tick in on this screen. Excel 2003 I think its under Tools > Macros?
 
Upvote 0
MARVELLOUS!!!!!!!!!

Add-ins it is.

All of the add-ins were unticked, i ticked them all and now it works as i'd expect.

Thanks ever so much for helping me out with this. And i apologise if i should have known this solution. As my avatar states............

Thanks again!!
:)
 
Upvote 0
If they were all uninstalled I have no idea how that could have been causing a problem :confused:

But if it now works for you thats great I guess!
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,752
Members
452,940
Latest member
rootytrip

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