I need some help with inserting and deleting rows in a table using vba in excel (1 Viewer)

david.paton

Registered User.
Local time
Today, 15:40
Joined
Jun 26, 2013
Messages
338
Now it won't let me convert to a range. I am selecting the table, right clicking on a cell but it doesn't give me the option.
 

david.paton

Registered User.
Local time
Today, 15:40
Joined
Jun 26, 2013
Messages
338
I moved the formulas then made another table. It still gives me the same error. When I have a cell within the table selected, the table tools menu item won't even show up.
 

david.paton

Registered User.
Local time
Today, 15:40
Joined
Jun 26, 2013
Messages
338
so it isn't registering as a table.
 

david.paton

Registered User.
Local time
Today, 15:40
Joined
Jun 26, 2013
Messages
338
This is driving me nuts! I went to an earlier version of the file where the table tools did show up but when ever I select it make it into a range and add in just the I to the new table, it gives me the same error.
 

david.paton

Registered User.
Local time
Today, 15:40
Joined
Jun 26, 2013
Messages
338
This is the row that is highlighted:


Set tbl = ws.ListObjects("Costing")


Is there anything wrong with this line as my table is called Costing, so I have no idea??
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:40
Joined
Sep 21, 2011
Messages
14,238
Your delete code has Table3 ?
I have no idea as to whether it is case sensitive. I am sure sheet names are not?
Anyway try that.


Code:
Set rng = ActiveSheet.ListObjects("Table3").Range


When I try and run it and press the add button row, this is the line that has the error:


Set tbl = ws.ListObjects("table3")


It says run time error 9, subscript out of range.
But that doesn't make sense as my table is set to table3??
 

david.paton

Registered User.
Local time
Today, 15:40
Joined
Jun 26, 2013
Messages
338
I found out what I should do. I just included the long formula in the cell in F7 so it updates correctly now.

Yay

Now I just need a way to ask for confirmation before deleting a row if the row has text in it...
 

Users who are viewing this thread

Top Bottom