VBA to convert table to range

General Ledger

Active Member
Joined
Dec 31, 2007
Messages
460
Dear All,

I am looking for VBA to convert a table to a range. I used the macro recorder and selected the Convert to range option from the Table Ribbon. The resulting macro was completely empty:


Code:
Sub Macro2()
'
' Macro2 Macro
'
'
End Sub

Any ideas?

Thanks,

GL
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
pgc01,

Your code works perfectly.

The code requires the name of the table. Can you advise what the code would be if you did not know the name of the table? Can you use a wildcard? This code does not work.

Code:
ActiveSheet.ListObjects("?").Unlist

Thanks,

GL
 
Upvote 0
Hi

You can also refer to the table using its index in the ListObjects collection. For ex., if you have just defined one table in the active worksheet, try:

Code:
ActiveSheet.ListObjects(1).Unlist
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,166
Members
448,870
Latest member
max_pedreira

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