Getting #Spill! code

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
774
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I am able to use a macro in a specific sheet with than a module. The macro was created by Mr. Stephen Crump. It works, with the exception I get the error #Spill!. I do know that is unique to 365, and because there is current data in the array that is blocking thus I get spillage.

The following is what Mr. Crump provided for me.
VBA Code:
 End If
     Application.EnableEvents = False
    Range("E2:E" & Range("D2").End(xlDown).Row).Formula2 = "=LET(v,VLOOKUP($D2,'State Country Code'!$A$2:$B$10388,2,0),TAKE(HSTACK(v,"""",v),,IF(LEN(v)=2,-2,2)))"
    Application.EnableEvents = True
End Sub

The code does work except I get the #Spill! in column E. I tried adding the "@"symbol in front of the look up value range to get my narrowed down to one result, but every time I enter something new I get the #Spill! in Column E if the cell is blank. In the end I do not want to have #Spill in by database.

I had thought about creating yet another Macro to clear out the error code, but the above formula I think will prevent that. I am hope like an "if" option could be used.

Here is my a my file and it only includes the columns/worksheet dealing with the above macro.

Dropbox


Lastly, the worksheet you see is populated with the use of a user form and all new entries are placed at the top.

Thank you,
 
You're right, the first line was the one getting flagged. I tried with the new code and it is spot on. It is perfect at least with my first several tests.

Thank you so much, and for your patience.
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

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