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.

Error en Vba Excel Combobox List Categoria

publicado

Hola, buenos dias tengo un problema en un combobox, el cual lo utilizo para listar categorias y dependiendo de eso listo otra categoria, pero tengo un error cuando el valor de la primera categoria es null o vacio "". aqui el codigo:

Private Sub cbo_Categoria_DropButtonClick()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("BD")
Dim i As Integer
Dim n As Integer

n = Application.WorksheetFunction.Match(Me.cbo_Categoria.Value, sh.Range("1:1"), 0)
Me.cbo_Tipo.Clear
For i = 2 To Application.WorksheetFunction.CountA(sh.Cells(1, n).EntireColumn)
    Me.cbo_Tipo.AddItem sh.Cells(i, n).Value

Next i
 

Tengo error en la linea n; porque el valor de cbo_Categoria es "", osea vacio.

como puedo solucionarlo.?

Editado el por ronalehm

Featured Replies

publicado
n = Application.WorksheetFunction.Match(Me.cbo_Categoria.Value, sh.Range("1:1"), 0)

If n = "" Then
MsgBox " Sin Dato "
else
	Me.cbo_Tipo.Clear

	For i = 2 To Application.WorksheetFunction.CountA(sh.Cells(1, n).EntireColumn)
    	Me.cbo_Tipo.AddItem sh.Cells(i, n).Value

	Next i

en If

Hola, revisa el código.

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.