How to convert the table to a regular range of data using VB script

djanu

Board Regular
Joined
Oct 30, 2006
Messages
55
Hi,

I used this to convert the table to a regular range of data in Excel 2003:

Sheets("Temp").ListObjects("List1").Unlist

This no longer works in Excel 2007. Is there any other way to do this in Excel 2007?

Thank you,
djanu
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
The above formula works in 2007 too. When you format your list as a table make sure that your table is called "List1".
To rename your table, select the entire range of you table, Click Design under Table Tools (the new tab that shows up in 2007), Change the name of the table to List1 under Properties>Table Name (first from left)
You should be able to convert your table into a range, same as 'Convert To Range' under Tools. But it does retain the color format you chose when formatting your range as a table. But you can use a simple macro to get rid of the colors too.
 
Upvote 0
I am actually importing for XML:

With Sheets("Temp").Range("A1").CurrentRegion
ActiveWorkbook.XmlImport URL:="C:\Temp\Test.xml", ImportMap:=Nothing, _
Overwrite:=True, Destination:=Sheets("Temp").Range("A1")
Sheets("Temp").ListObject("List1").Unlist

Where do I specify table name?
 
Upvote 0
Thank you! It works now:

Private Sub CommandButton1_Click()

'IMPORT XML - This part will import .xml file to Excel

With Sheets("Temp").Range("A1").CurrentRegion
ActiveWorkbook.XmlImport URL:="C:\Temp\Test.xml", ImportMap:=Nothing, _
Overwrite:=True, Destination:=Sheets("Temp").Range("A1")
Sheets("Temp").ListObjects("Table1").Name = "List1"
Sheets("Temp").ListObjects("List1").Unlist
End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,726
Members
452,939
Latest member
WCrawford

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