Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

If que compara si una variable esta dentro de un array

publicado

saludos cordiales como indica el titulo deseo hacer una condicional if que me compare si una variable esta dentro de un array de esta forma if tipo=array(1,2,3) then "la condicion dada" es decir si el tipo va del 1-3 que se ejecute la condicion, pero no me sale .agradezco su amable ayuda al respecto de esta duda.gracias

Featured Replies

publicado

Hola,

Sería mas o menos así
 

...

MyArray=(1,2,3)

for x=1 to 3

      if tipo=MyArray(x) then Msgbox "Encontrado": Exit function/Sub ' o lo que sea

next x

.....

 

publicado
  • Autor
Hace 20 horas, ikanni dijo:

Hola,

Sería mas o menos así
 


...

MyArray=(1,2,3)

for x=1 to 3

      if tipo=MyArray(x) then Msgbox "Encontrado": Exit function/Sub ' o lo que sea

next x

.....

 

Hola gracias Ikanni sabes no me sale,mira la imagen a ver que esta mal para corregirlo por favor saludos 

image.png.960bff86b34fc2473af1fa495b5631e2.png

publicado

...

Myarray=Array(1,2,3)

for x=0 to 2

      if tipo=MyArray(x) then Msgbox "Encontrado": Exit function/Sub ' o lo que sea

next x

.....

 

Editado el por Antoni

publicado
  • Autor
Hace 4 horas, Antoni dijo:


...

Myarray=Array(1,2,3)

for x=0 to 2

      if tipo=MyArray(x) then Msgbox "Encontrado": Exit function/Sub ' o lo que sea

next x

.....

 

Gracias Antoni una pregunta la forma de declarar la variable Myarray es como la puse yo???

dim Myarray() as integer??? saludos

publicado
  • Autor
Hace 8 horas, Antoni dijo:

Dim MyArray As Variant

 

Option Explicit
Option Base 1
Public Sub n()
Dim x As Integer
Dim tipo As Integer
Dim Myarray As Variant
tipo = 1
Myarray = Array(1, 2, 3)
For x = 1 To 2
If tipo = Myarray(x) Then
MsgBox x
End If
Next x
End Sub

Muchas gracias a todos ,son grandes tema cerrado

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.