Link to home
Start Free TrialLog in
Avatar of Euro5
Euro5Flag for United States of America

asked on

VBA run out of memory

The code Zone_Change worked on a small set of data, but with larger data I get a memory error.

Line -      rngData = .Range("A2:BD" & .UsedRange.Rows.Count).Value
Is there another method other than the array?

I attached the entire project.
What-if-scenario-v4.2.xlsm
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Try closing Excel and reopening it. You could try rebooting your PC.
Avatar of Euro5

ASKER

Right, thanks for mentioning. I should have said that I did try that. It does most often work, but unfortunately didn't this time.
You could also include only the columns that you actually need to work with like

Range("A2:C,F2:J,M2:BD")

Do similar when you put the results back on the sheet.
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually with my code you'd need to do

Dim lngRows As Long
lngRows = ActiveSheet.UsedRange.Rows.Count

rng = Range("A2:C" & lngRows, "F2:J" & lngRows, "M2:BD" & lngRows)

Got to go. Play calls (actually a play)
Avatar of Euro5

ASKER

I think that you offered this before - it worked again.
I think there are some other places that this will be helpful.
Avatar of Euro5

ASKER

@Martin - what play!??
West Side Story
Avatar of Euro5

ASKER

Nice. Hope you enjoy! Love musicals and opera.