Insertar un checkbox por cada celda con datos

Espero me puedan ayudar Soy nueva en esto y mis conocimientos en macros es básico; existe alguna manera de indicar en una macro de vb en excelente; la cual por cada celda de la columna A tenga datos inserte en la columna B un checkbox. Lo intenté hacer con la grabadora de macros pero mi intento fue fallido.

1 respuesta

Respuesta
1

Esta macro te debería servir:

Sub checkboxes()
Dim cell, LRow As Single

Dim chkbx As CheckBox

Dim CLeft, CTop, CHeight, CWidth As Double

Application.ScreenUpdating = False

LRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row

For cell = 1 To LRow

If Cells(cell, "A").Value <> "" Then

CLeft = Cells(cell, "B").Left

CTop = Cells(cell, "B").Top

CHeight = Cells(cell, "B").Height

CWidth = Cells(cell, "B").Width

ActiveSheet.checkboxes.Add(CLeft, CTop, CWidth, CHeight).Select

With Selection

.Caption = ""

.Value = xlOff

.Display3DShading = False

End With

End If

Next cell

Application.ScreenUpdating = True

End Sub

¡Gracias! Es una excelente respuesta me ayudó muchísimo

Hola, recurro a ti para hacerte una consulta, usando el mismo problema para realizar la macro anterior, sólo que ahora en lugar de check box quisiera agregar una lista desplegable, lo que hice fue cambiar la instrucción ActiveSheet.checkboxes.Add(CLeft, CTop, CWidth, CHeight).Select, checkboxes por listboxes; pero no lo logré me manda un error además de que no me permite insertar los valores que tengo en la columna C para que el usuario elija un valor. Quizás podría ayudarme.

Nuevas preguntas en huevos hilos, así cualquier experto puede ayudarte

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas