Runtime Error 1004

Mogogo

New Member
Joined
Jan 14, 2010
Messages
14
Office Version
  1. 2016
I receive an error when running a recorded macro that I don't know how to fix. The macro copies data into a named worksheet then I use CTL 'T' to format the copied data as a table (allowing user to sort/filter as needed). When I run the macro I receive the error;

Run-time error '1004':
A table cannot overlap another table.

I believe it is seeing the table format as being already there from using the CTL 'T' during recording. It identified the table as "Table3" during setup but subsequent runs assign a sequential number so it does recognize the "Table3" name.

Anyone know a fix around this?

Code:
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$7:$AH$107"), , xlYes).Name = _
"Table3"
Range("Table3[#All]").Select
[code]
 
Once I have this figured out I am going to ask if there is a way to have the macro run a loop that checks to see if there is a blank in the cell of the first column and if so delete that row and continue checking for 100 rows. I would want to do this immediately prior to formatting the data as a table (the copied data may or may not have data in each row).
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
If you import it then format it as a table once this will work. But if you are trying to import data every time it loads you will have to delete the table 3 before creating it again.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top