Insert column into external data range

dblaze

New Member
Joined
Apr 12, 2011
Messages
2
I have a sheet that gets its data from an Access query. What I need to do is insert several columns after the query refreshes. When I try:

Columns("G:G").Select
Selection.Insert Shift:=xlToRight

instead of it selecting just column G, it selects the entire sheet. I suspect there is something different about the Access range returned that won't let me insert columns. Any ideas?

Thanks,
Doug
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Yes, the top row is a merged cell. I removed that and now the insert works. Thanks - I'll remember that!

Doug
 
Upvote 0
Welcome to the Board!

You also don't need to select:

Columns("G:G").Insert Shift:=xlToRight

Generally whenever you see "Select" followed by "Selection" you can get rid of both of them.

HTH,
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

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