One thing is to re-check the type of
xlWorksheetNew
is it correctly defined.
Another thing is that if you want to cast the columns before
Delete
is called, you need to apply parenthesis. In other words
((Excel.Range)xlWorksheetNew.Columns["P:Q"]).Delete();