Delete Columns

rollingzep

Board Regular
Joined
Nov 18, 2013
Messages
214
Office Version
  1. 365
Platform
  1. Windows
Hi All,

At work, I use a large workbook of 30kb. My workplace has the MS office 32-bit version.
The issue is, in my VBA code, when i try to delete columns using ws.range("AS":"BA"). delete, I run into memory issues and space shortage errors.
This code is at the very end of the module.
But when I comment this line, I have no issues at all. The module executes perfectly.

But I need to delete these columns as a part of clean up.
I am currently manually deleting them after all data has been imported and the report is generated.

Is there a workaround?

TIA.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
What happens when you try
VBA Code:
ws.Columns("AS:BA").Delete

instead of
VBA Code:
ws.Range("AS":"BA").Delete
 
Upvote 0
for future reference, you could also record a macro doing exactly that....and see the correct outcome. Macro Recorder is your friend.
:cool:(y)
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,172
Members
448,554
Latest member
Gleisner2

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