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
Euro5Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Try closing Excel and reopening it. You could try rebooting your PC.
0
Euro5Author Commented:
Right, thanks for mentioning. I should have said that I did try that. It does most often work, but unfortunately didn't this time.
0
Martin LissOlder than dirtCommented:
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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Saurabh Singh TeotiaCommented:
I run this line Euro..I dont face any problem..try closing the excel and open it again and run the code again..

Or you can try using this lines...

Dim lrow As Long

lrow = .Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    ' Copy the cell values (ignoring the headers) from columns A to BD to an array
    rngData = .Range("A2:BD" & lrow).Value

Open in new window


Saurabh...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Martin LissOlder than dirtCommented:
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)
1
Euro5Author Commented:
I think that you offered this before - it worked again.
I think there are some other places that this will be helpful.
0
Euro5Author Commented:
@Martin - what play!??
0
Martin LissOlder than dirtCommented:
West Side Story
0
Euro5Author Commented:
Nice. Hope you enjoy! Love musicals and opera.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.