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.

Insertar Comentario en celda desde textbox de un userform

publicado

Buen día, tengo el siguiente problema:

Necesito insertar un comentario en una celda de un registro de datos que se va completando a través de un Userform. Uso el siguiente código (En rojo, las líneas que insertan el comentario en la celda):

 Set TransRowRng = ThisWorkbook.Worksheets("RESUMEN GENERAL").Cells(1, 1).CurrentRegion
        NewRow = TransRowRng.Rows.Count + 1
                            
        With ThisWorkbook.Worksheets("RESUMEN GENERAL")
          
           .Cells(NewRow, 1) = CDate(txtFechaUno)
           .Cells(NewRow, 2) = UCase(TextBox1.Value)
           .Cells(NewRow, 3) = Format(TextBox3, "00"".""000"".""000""-""0")
           .Cells(NewRow, 4) = ComboBox1
           .Cells(NewRow, 5) = CDbl(TextBox2)
           .Cells(NewRow, 5).AddComment
           .Cells(NewRow, 5).Comment.Text Text:=TextBox6.Value

           .Cells(NewRow, 6) = UCase(TextBox5)
           .Cells(NewRow, 7) = ComboBox2
           .Cells(NewRow, 8) = Val(TextBox4)
                If .Cells(NewRow, 8).Value = 0 Then
                    .Cells(NewRow, 8).Select
                    Selection.ClearContents
                End If
        Sheets("RESUMEN GENERAL").Select
        Range("a1").End(xlDown).Select
        End With

El problema que se me presenta es cuando dejo vacío el TextBox6 (porque no siempre necesito insertar comentarios en esa celda); me manda a depurar.. Me edad error.

Que puedo hacer para eliminar este error?

 

 

Featured Replies

publicado
  • Autor

Además me gustaría que cuando el TextBox6 quede vacío, no inserte comentarios en esa celda.

publicado
if Not Trim(TextBox6) = "" Then
   .Cells(NewRow, 5).AddComment
   .Cells(NewRow, 5).Comment.Text Text:=TextBox6
End If

 

publicado
  • Autor

Muchas Gracias Antoni.   Estaba cerca de la solución...   Pero siempre es bueno consultar con los expertos.

Gracias....

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.