07-15-2015, 08:06 AM
I have no idea what's going wrong.
The selectRange method randomly keeps failing at every run, whereever it is coded:
Macro NC VCC Release Corrections
The selectRange method randomly keeps failing at every run, whereever it is coded:
Macro NC VCC Release Corrections
ARRAY(str) SANamesMaster, SANamesCheck
int counter1, repeatFlag
int w1=act(win("Microsoft Excel - LR Sales" "XLMAIN"))
ExcelSheet es.Init
repeatFlag=0
;Obtain 2 Excel lists(dynamic ranges) into arrays
es.Activate(1 "Data") ;;Activate Sheet
wait 0.5
es.SelectRange("M:M" 1) ;;obtain used range
es.CellsToArray(SANamesMaster "sel") ;;Obtain Master list of Sales Advisor Names from 'Data' Sheet
es.SelectRange("A1")
es.Activate(1 "VCC Release Spool") ;;Activate Sheet
wait 0.5
es.SelectRange("G1") ;;Set Excel cursor at column G1
;es.SelectRange("G:G" 1) ;;obtain used range
;nextCell
if repeatFlag<=5
,'D ;; Go Down 1 cell
,es.CellsToArray(SANamesCheck "sel") ;;Store to array 'To Be Checked' cell of Sales Advisor Names from 'VCC Release Spool' Sheet
,es.SelectRange("A1")
else
,ret ;;Ends Macro as the 'SANamesCheck' list is now fully checked.
if SANamesCheck.len ;;Check if array is not empty
,goto arrayCheckRoutine
else ;;If empty increase checkFlag by 1 and repeat above provess again for upto 5 times to make sure we have reached the end of the list
,repeatFlag=repeatFlag+1
,goto nextCell
;arrayCheckRoutine
;;Check one array against another and change those not in Master list
for counter1 1 SANamesMaster[0 counter1] ;;Loop through Master List Array
,if SANamesCheck=SANamesMaster[0 counter1] ;;Check if current SANamesCheck is in SANamesMaster list
,,break
,else
,,goto obtainSANameFromAL
repeatFlag=0 ;;Reset Flag
goto nextCell
;obtainSANameFromAL
;;Check Autoline system for the correct SA Name and replace in Excel
out SANamesCheck
Best Regards,
Philip
Philip
