excel - VBA Windows(Index).Activate causes Run-time error '9': Subscript out of range -
i have almost-complete vba macro runs fine until reaches line:
windows(temp_name).activate
when run following error:
run-time error '9':
subscript out of range
temp_name name of file need return to. here lines around (tell me if more lines necessary):
next ind application.cutcopymode = false workbooks.opentext filename:=cpath _ , origin:=437, startrow:=1, datatype:=xldelimited, textqualifier:= _ xldoublequote, consecutivedelimiter:=false, tab:=false, semicolon:=false _ , comma:=true, space:=false, other:=false, fieldinfo:=array(array(1, 1), _ array(2, 1), array(3, 1), array(4, 1), array(5, 1), array(6, 1), array(7, 1), array(8, 1), _ array(9, 1), array(10, 1), array(11, 1), array(12, 1), array(13, 1)), _ trailingminusnumbers:=true ind1 = 1 iplateno tlcorn = "b" + cstr(istartrow + (ind1 - 1) * istep) brcorn = "m" + cstr(istartrow + 7 + (ind1 - 1) * istep) rangenout = tlcorn + ":" + brcorn rangenin = tlcorn windows(filen).activate range(rangenout).select selection.copy windows(temp_name).activate sheets("data").select range(rangenin).select selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _ :=false, transpose:=false next ind1 ' calculation of background , efflux individual plates ind1 = 1 iplateno / 2 istep2 = (ind1 - 1) * istep * 2 ibgrrow = istartrow + 8 + istep2 bgrvalp = cells(ibgrrow, 2).value ind2 = 0 7 ientryrow = istartrow + ind2 + istep2 ientryrow2 = istartrow + ind2 + istep2 + 11 mediaval = cells(ientryrow, 13).value monoval = cells(ientryrow2, 13).value cells(ientryrow, 15).value = meeff * 100 * volcorr * (mediaval - bgrvalp) / (m40eff * monoval + volcorr * meeff * (mediaval - bgrvalp)) next ind2 next ind1
try
workbooks(temp_name).activate
this reference specific excel workbook instance believe failing find workbook intending reference. assuming sheets("data") worksheet within whatever workbook name held in "temp_name" @ time?
thanks,
jamie
Comments
Post a Comment