scusate ma dove sta l'errore mi dice ce è nella riga dell' else in rosso


codice:
dim counter
dim volte
counter=0
i=0
do
i=instr(i+1,txt,"[")
if i>0 then counter=counter+1
loop until i=0
' verifico come inizia e come finisce
				
if (Left(txt,1)="[") then
   if (Right(txt,1)="]") then volte = (counter*2)-1
      else
      volte = (counter*2)
   end if
else 
   if (Right(txt,1)="]") then volte = (counter*2)
      else
      volte = (counter*2)+1
   end if
end if