Consulta sobre macro para copiar celda a cuadro de texto

Se que parece un tema muy simple pero me busque todo y no encuentro la respuesta.
Tengo un listado con varios datos y quiero crear un botón, para que pase todos esos datos a la hoja 2.
El tema es que algunos valores los tiene que pasar a una celda normal, hasta ahí no hay problema, pero el problema es cuando otros valores deben cargarse en unos cuadros de texto.
No encuentro la forma de hacerlo mediante una macro.
Serán tan amables de iluminarme con un ejemplo.

Respuesta
1

Puedes poner una imagen de lo que tienes en la hoja1

Y otra imagen con el resultado que esperas en la hoja2

Me explicas qué datos y por qué van en celdas y también me explicas qué datos y por qué van en "cuadros de texto".

Esos "cuadros de texto" son de formulario o ActiveX y cómo se llama cada uno

¡Gracias! Ya lo resolví solo te voy a consultar si ves algún error en esta macro:

Sub Macro1()
'
' Macro1 Macro
'
' Acceso directo: CTRL+r
'
Dim strTexto As String
strTexto = ""


Sheets("PLANILLAS").Select
strTexto = Range("D5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("1 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("E5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("3 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("F5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("4 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("G5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("5 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("H5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("8 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("I5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("9 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("J5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("11 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("K5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("12 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("L5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("13 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("M5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("14 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("N5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("15 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
Sheets("PLANILLAS").Select
strTexto = Range("O5").Value
Sheets("RECIBOS").Select
ActiveSheet.Shapes.Range(Array("16 TextBox")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto
strTexto = ""
End Sub

No puedo saber si tiene errores, necesito saber qué tipo de textbox estás utilizando.

Pero si la macro te funciona, entonces no veo cuál sea el problema.


Por otra parte, si tienes un textbox de ActiveX

Este código:

    strTexto = ""
    Sheets("PLANILLAS").Select
    strTexto = Range("D5").Value
    Sheets("RECIBOS").Select
    ActiveSheet.Shapes.Range(Array("1 TextBox")).Select
    Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = strTexto

Lo puedes poner de esta forma:

    Sheets("RECIBOS").TextBox1.Value = Sheets("PLANILLAS").Range("D5").Value

E spero te sea de utilidad. Sal u dos

¡Gracias! 

Es un cuadro de texto normal insertado en una planilla en blanco.

Esa línea no funciona, pero mil gracias por la ayuda!

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas