Foros del Web » Soporte técnico » Ofimática »

userform excel y mas

Estas en el tema de userform excel y mas en el foro de Ofimática en Foros del Web. Muy buenas! A ver si alguien puede echarme una manita. Asiaaaaas! De momento, tengo una base de datos en una hoja y hago las consultas ...
  #1 (permalink)  
Antiguo 03/01/2008, 08:38
 
Fecha de Ingreso: enero-2008
Mensajes: 1
Antigüedad: 16 años, 4 meses
Puntos: 0
userform excel y mas

Muy buenas! A ver si alguien puede echarme una manita. Asiaaaaas!

De momento, tengo una base de datos en una hoja y hago las consultas en otra. Pero la idea es dejar un documento solo con la hoja de base de datos e ir haciendo las consultas con otros documentos. El codigo del formulario que tengo de momento es el siguiente:

Private Sub ComboBox1_Change()

End Sub

Private Sub ComboBox1_Click()
nbreHoja = ComboBox1.Value
Sheets(nbreHoja).Select

End Sub

Private Sub CommandButton1_Click()
With Worksheets("material").Activate
Cells.Find(What:=TextBox1, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate

ActiveCell.Offset(0, 0).Select
TextBox2 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox3 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox4 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox5 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox6 = ActiveCell
ActiveCell.Offset(0, 3).Select
TextBox7 = ActiveCell
ActiveCell.Offset(0, 1).Select
TextBox8 = ActiveCell

End With
End Sub

Private Sub CommandButton5_Click()
Rem Activeworksheets.Activate
ActiveSheet.Select
Worksheets("hoja1").Activate
NextRow = Application.WorksheetFunction.CountA(Range("A:A")) + 1

Cells(NextRow, 1) = TextBox2
Cells(NextRow, 2) = TextBox3
Cells(NextRow, 3) = TextBox4
Cells(NextRow, 4) = TextBox5
Cells(NextRow, 5) = TextBox6
Cells(NextRow, 6) = TextBox7
Cells(NextRow, 7) = TextBox8

TextBox1 = Empty
TextBox2 = Empty
TextBox3 = Empty
TextBox4 = Empty
TextBox5 = Empty
TextBox6 = Empty
TextBox7 = Empty
TextBox8 = Empty
End Sub

Private Sub Label9_Click()

End Sub

Private Sub UserForm_Click()

End Sub


Con este formulario tengo dos botones, buscar e insertar. Me busca la palabra que le digo a la base de datos (hoja "material") y me la inserta en la siguiente fila vacía de la hoja 1. Pues bien, me gustaría ejecutar el macro desde cualquier hoja de cualquier documento, que me buscara en la base de datos y que se insertara en la hoja activa, donde he ejecutado el macro. Y luego volver a la hoja activa, claro.

Espero que me entiendan. Muchas gracias!!

Chaooo

Petercris
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:25.