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.

Seleccionar "x" fila y "x" rangos de la fila de una hoja y pegarlos en otra hoja

publicado

Hola a todos soy nuevo en este foro, este es mi problema tengo que crear la forma de que con un formulario el usuario introduzca en un TextBox numero de gafet y al dar clic al botón este busque y seleccione la fila donde encontró el dato y ciertos rangos sean copiados y pegados en otra hoja de Excel 2003 lo que yo hice fue crear dos hojas dentro de mi libro hoja1 se llama “bd” , hoja2 se llama “reporte”, en bd tengo una tabla con los campos

gafet nomina nombre apellido proyecto

en la hoja “reporte” se peguen gafet nomina nombre apellido , nombre y apellido juntos y la fecha y hora en cuanto caiga el dato.

Lo que yo hice fue una internas con su botón buscar este lo busca y muestra los campos que yo quier ver y cree un botón enviar el cual se envían los datos a otra tabla en otra hoja.

Este es el código:

' boton buscar

Private Sub CommandButton1_Click()

Dim id_gafet As Integer

Dim idBuscar As Integer

Dim fila As Integer

fila = 1

id_gafet = TextBoxBusca '''

Do While idBuscar <> id_gafet

fila = fila + 1

idBuscar = Range("A" & fila).Value

If idBuscar = Empty Then

MsgBox "No se encontro dato"

Exit Do

End If

Loop

Dim nom, ap As String

Dim num_gafet, num_nomina As Integer

nom = Range("C" & fila).Value

ap = Range("D" & fila).Value

TextBox2 = nom & " " & ap

TextBox3 = Range("A" & fila).Value

TextBox4 = Range("B" & fila).Value

TextBoxBusca.SetFocus

''''''''''''''''''''''''''''''''''''''''''

End Sub

' boton enviar

Private Sub CommandButton2_Click()

ActiveSheet.Protect DrawingObjects:=False, Contents:=False, Scenarios:=False

ActiveWorkbook.Protect Structure:=False, Windows:=False

Sheets("REPORTE").Activate

If TextBox2 = "" Or TextBox3 = "" Or TextBox4 = "" Then

MsgBox "Esta dejando campos requeridos vacion favor complete", vbExclamation, "REPORTE"

TextBox3.SetFocus

Else

Range("A" & Cells.Rows.Count).End(xlUp).Offset(1).Select

ActiveCell = TextBox3.Value

ActiveCell.Offset(0, 1) = TextBox4.Value

ActiveCell.Offset(0, 2) = TextBox2.Value

'ActiveCell.Offset(0, 3) = TextBox2.Value

MsgBox "Empleado ingresado exitosamente", vbInformation, "ServiCal"

'TextBox3 = ""

TextBox4 = ""

TextBox2 = ""

TextBox2.SetFocus

End If

' codigo para colocar la hora un la columna deseada

Dim x As Long, y As Long

With ActiveSheet

x = .Cells(.Rows.Count, "D").End(xlUp).Row + 1

y = .Cells(.Rows.Count, "A").End(xlUp).Row

If x <= y Then

.Range(.Cells(x, "D"), .Cells(y, "D")) = _

DateSerial(Year(Date), Month(Date), Day(Date))

End If

End With

' codigo para colocar hora automatica

Range("D1").Select

While ActiveCell <> ""

ActiveCell.Offset(0, 1).Select

While ActiveCell <> ""

ActiveCell.Offset(1, 0).Select

Wend

ActiveCell.Value = Format(Now, "hh:mm:ss")

ActiveCell.Offset(0, -1).Select

ActiveCell.Offset(1, 0).Select

Wend

Sheets("BD").Activate

End Sub

Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)

If KeyAscii < 47 Or KeyAscii > 57 Then KeyAscii = 0

End Sub

Private Sub TextBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)

If KeyAscii < 45 Or KeyAscii > 57 Then KeyAscii = 0

End Sub

Private Sub TextBox4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)

If KeyAscii < 47 Or KeyAscii > 57 Then KeyAscii = 0

End Sub

' boton para salir

Private Sub CommandButton3_Click()

End '--> Liquida TODAS las variables y/o similares de la memoria

Hide '--> Solo oculta el userform, mas no lo descarga de la memoria

Unload Me '--> Descarga el userform de la memoria

End Sub

Featured Replies

No hay posts para mostrar

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.