Ver Mensaje Individual
  #6 (permalink)  
Antiguo 27/04/2010, 07:44
Avatar de Monimo
Monimo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Mexico Df
Mensajes: 742
Antigüedad: 16 años, 5 meses
Puntos: 69
Respuesta: Obtener un Valor de una matriz con tres parametros.

ay a ver. Yo estoy suponiendo q tu matriz es así:

.........AG...........AH.........AI............AJ. ...........AK
2 .....13 ..............BAJA.....MEDIA.....ALTA ...CRITICA
3 .....PLATINO.....2880.....360.........240 ....30
4......ORO...........7200.....1440.......360 .....30
5......PLATA.........4200.....1800.......600 .....30
6......BRONCE......6000.....4200......1200 ....30

y que el 1,2,3,4 son los renglones correspondientes a excel y no a valores. Y que AG, AH etc son columnas de excel y no valores cierto?
Entonces si quieres escoger la matriz 13. haces esto:

Cells.Find(What:="13", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
rowt = ActiveCell.Row
colt = ActiveCell.Column
y despues recorres el renglon y las columnas, por ejemplo:

yo escojo media y plata y la matriz 13.

Cells.Find(What:="13", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
rowt = ActiveCell.Row
colt = ActiveCell.Column

mivariable1="MEDIA"
mivariable2="PLATA"
dim memuevo1 as integer
memuevo1=colt
memuevo2=rowt
do while mivariable1 <> cells(rowt,memuevo1).value
memuevo1=memuevo1+1
loop

'cuando encuentre MEDIA te dara la columna donde esta media ahora vemos el renglon

do while mivariable2 <> cells(memuevo2,colt).value
memuevo2=memuevo2+1
loop

'cuando encuentre PLATA se para y te devuelve el renglon, el valor que quieres se forma por la columna de memuevo1 y el renglon de memuevo2.

mivalor=cells(memuevo2,memuevo1).value
msgbox(mivalor)