#1
|
|||
|
|||
Why is listrows.add not working in excel 2007?
Hi, I'm trying to add row to the end of the table "mt" but it is showing a run time error 9, subscript out of range but why?
File attached. Pls help |
#2
|
|||
|
|||
"mt" is not the name of your table.
On the Formula ribbon, click Name Manager and you can filter for "Table Names" to see. |
#3
|
|||
|
|||
Hi, but in my pc it is showing "mt" as table name...btw, how can I do it without giving the table a name?
|
#4
|
|||
|
|||
All I have to go by is the file you posted and it does not have a table named "mt".
Table1 is the default name Excel gave to the table at the time it was created, I suspect you tried to rename it and in the process created the named range "mt". Click the drop down arrow in the Name Box above column A, you'll see both mt and Table1. Selecting each of them, you'll see they are not the same, one includes row 1 and one doesn't. Quote:
Here's a couple of links to sites with info on Excel Tables: The VBA Guide To ListObject Excel Tables — The Spreadsheet Guru Excel: Working with Tables (VBA) |
#5
|
||||
|
||||
You have a named range mt so you could:
Code:
Set tbl = Range("mt").ListObject If you know where the table is you can use any cell of that table to refer to the table: Code:
Set tbl = Sheets("Sheet1").range("A1").listobject Code:
Sheets("Sheet1").Range("A1").ListObject.ListRows.Add |
Tags |
vba excel |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
MS Outlook 2007 Search Not Working | Harry Rolnick | Outlook | 1 | 04-06-2016 12:59 PM |
Excel error window: Excel has stopped working | MunganBrus | Excel | 1 | 01-13-2015 11:19 AM |
How can I fix a print view problem that causes it to stop working.. Excel 2007, Vista | birdie123 | Excel | 0 | 08-18-2012 12:02 PM |
Excel 2007 to Word 2007 Labels mail merge not working | rec | Mail Merge | 0 | 07-31-2010 10:45 AM |
HELP!! With Outlook 2007. STILL not working | jbiggs | Office | 1 | 02-12-2009 09:02 AM |