How to fix Run-time error 448

I used some old code created in Excel 2007 and repurposed it for another file in Excel 2003.  See code below.  

The user got a run-time error 448.  I imagine there is some wording in the code that isn't suited to the prior version of Excel?  Or is it that UserInterfaceOnly should equal False?  Unfortunately, I can't recreate the problem on my PC.  The code words great in Excel 2010's compatibility mode.

Any light you can shed, would be very much appreciated!
Sub InsertTableRow()

 Range("B9").Select
    ActiveSheet.Unprotect Password:="password"
    Selection.ListObject.ListRows.Add AlwaysInsert:=False
    ActiveSheet.Protect Password:="password", UserInterfaceOnly:=True, AllowSorting:=True, AllowFormattingCells:=True, _
                    AllowInsertingRows:=True, AllowDeletingRows:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True
    ActiveCell.Select
    Call IndextoLastRowinTable

End Sub

Sub IndextoLastRowinTable()
'
'
    Range("B300").Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(-1, 0).Range("A1").Select
End Sub

Open in new window

LVL 1
xllvrAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vguzmanIT ManagerCommented:
are both subs in the same worksheet/module ?
if not make sure IndextoLastRowinTable its a public sub
0
vguzmanIT ManagerCommented:
is the code stopping at ActiveSheet.Protect... line ?
0
xllvrAuthor Commented:
Both subs are in the same module.  In terms of your other question, I'm not certain where the code is stopping but can ask tomorrow.  

If it is stopping at that line, do you have a suggestion as to how I should handle it?  

Thanks so much for replying!
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

GrahamSkanRetiredCommented:
I think that that AlwaysInsert argument was not there in Excel 2003

Selection.ListObject.ListRows.Add AlwaysInsert:=False
0
xllvrAuthor Commented:
Graham,

Just heard from the user and the line the code hangs up on is exactly what you just mentioned.

Selection.ListObject.ListRows.Add AlwaysInsert:=False

Any suggestions as to how I can allow the user to insert a row within the table and avoid the code hanging up on him?

Thanks!
0
xllvrAuthor Commented:
Hope your holiday was good!  Was hoping to re-engage on this question.  Is there a line of code I can use to replace

Selection.ListObject.ListRows.Add AlwaysInsert=False

or the user who is working in Excel 2003?  Again, the idea is for the user to be able to insert a row within a Table/List in Excel 2003 while the sheet is protected.  (All code is attached above.)
0
GrahamSkanRetiredCommented:
Just try:

Selection.ListObject.ListRows.Add

without the  AlwaysInsert=False bit.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xllvrAuthor Commented:
Thanks so much for following through!  Much appreciated.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.