Do you really need an auto-cast spell to do that?
You can solve your problem in more than 1 ways.
The simplest one would be if you know JASS:
Event: A unit enters playable map area
Condition: ---- your conditions (like... is the unit a certain unit-type) ----
Actions: Create a trigger (requires jass), with event "A unit comes in range"
Save the Triggering unit into a hashtable, with a key - the new trigger (still requires jass)
And as actions (technically "conditions") - add the function you want executed when the event runs.
like...
JASS:
local unit charger = LoadUnitHandle(TableName, GetHandleId(GetTriggeringTrigger()), 'unit')
local unit target = GetTriggerUnit()
// do stuff
Another way to do that, which is less eficient, but doesn't require JASS knowledge would be:
make a trigger with no events, that does the stuff you want the happen (something like the trigger you currently have for the 'on spell cast' event)
And every time a unit enters the playable map area, if it's matching your conditions - add an event to the 1-st trigger "A unit comes in range xxx from Triggering unit"
However, using this way - you will be getting the "target" as "Triggering unit", but you woudln't be able to directly tell which is the unit that needs to do the charge. You'd need to group all the units in range from the triggering unit, and check if they are of type 'the type that can charge' (for example). And if more than 1 unit matches that condition - you need to filter somehow which is the correct unit.
ANOTHER way would be to:
Make a periodic event (let's say it runs every 0.1 seconds)
It loops trough a unit group, and for every picked unit - it picks all the units in xxx range from it, and checks if that unit is enemy or ally. If it's enemy - it makes the initially picked unit charge the newly picked one.
You also need to have a trigger "A unit enters playable map area", if it matches your conditions - add the unit to the group the 1-st trigger is looping trough.
DON'T FORGET: to do an extra check to see if the unit hasn't already done that "charge", so it doesn't start charging like crazy