XL2001: Error Message Received After Recording a Macro to Delete Multiple Rows or Columns in a List (270089)



The information in this article applies to:

  • Microsoft Excel 2001 for Mac

This article was previously published under Q270089

SYMPTOMS

When you record a macro to delete multiple rows or columns from a list, the macro does not run, and you receive the following error message:
Run-time error '438':

Object doesn't support this property or method

CAUSE

This problem occurs because the macro recorder fails to include the name of the list as an argument for ListObjects() in the code for the macro.

For example, the following two lines of code appear in a macro recorded to delete the first two columns in List1:
ActiveSheet.ListObjects("List1").ListColumns(1).Delete
ActiveSheet.ListObjects().ListColumns(1).Delete
				
The following is missing in the second line of code as an argument for ListObjects:

"List1"

WORKAROUND

To work around this problem, edit the macro manually so that it will run without error. To do this, follow these steps:
  1. On the Tools menu, point to Macro, and then click Macros.
  2. In the Macro dialog box, under Macro name, select the macro you created to delete the multiple rows or columns, and then click Edit.
  3. In the Code window, place the insertion point between the parentheses following ListObjects in the line that follows the first Delete command line, and then type "List#" (including the quotation marks), where List# is the name of the list you are modifying. The second line should now be identical to the line that precedes it.
  4. Repeat step 3 for each subsequent line containing the delete command, until they are all identical to the first Delete command line.
  5. On the File menu, click Close and Return to Microsoft Excel.
  6. Run the macro.
Notice that the two left columns of the list are deleted.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was corrected in Microsoft Excel X for Mac.

MORE INFORMATION

For more information about using the List Manager, follow these steps:
  1. On the Help menu, click Contents and Index, click Index, and then click L.
  2. Scroll down until you locate list, and then click the arrow to the left to view a list of topics under the general topic.
  3. Click Guidelines for creating a list by using the List Manager.
If you cannot find the information that you want, ask the Office Assistant.


Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbbug kberrmsg kbpending KB270089