Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   Software General (http://www.forosdelweb.com/f23/)
-   -   excel (http://www.forosdelweb.com/f23/excel-118471/)

lmg7 01/03/2003 00:52

A ver si te sirve...
 
Hacé lo siguiente:

- En el libro a auditar crea una hoja llamada Uso
- Seleciona Herramientas\Macro\Editor de Visual Basic (o Alt+F11).
- En el editor: Insertar\Módulo y te crea una módulo.
- Dentro del módulo copia el siguiente código:

Código:

Sub auto_open()
    Hoja = ActiveSheet.Name
    If ActiveSheet.Name <> "Uso" Then Sheets("Uso").Select
    ActiveSheet.Unprotect ("Luis")
    Cells(1, 1).Select
    Selection.End(xlDown).Select
    Selection.Offset(1, 0).Select
    ActiveCell.Value = Application.UserName
    Selection.Offset(0, 1).Select
    ActiveCell.Value = Now()
    ActiveSheet.Protect ("Luis")
    Sheets(Hoja).Select
    ActiveWorkbook.Save
End Sub
Sub auto_close()
    Hoja = ActiveSheet.Name
    If ActiveSheet.Name <> "Uso" Then Sheets("Uso").Select
    ActiveSheet.Unprotect ("Luis")
    Cells(1, 1).Select
    Selection.End(xlDown).Select
    Selection.Offset(0, 2).Select
    ActiveCell.Value = Now()
    Selection.Offset(0, 1).Select
    ActiveCell.FormulaR1C1 = "=(RC[-1]-RC[-2])*24"
    ActiveSheet.Protect ("Luis")
    Sheets(Hoja).Select
    ActiveWorkbook.Save
End Sub

- Remplazá Luis por una contraseña de tu elección.

Listo!, cada vez que alguien use el libro, en la hoja Uso, se almacenará el nombre del usuario, la fecha y hora del ingreso, la fecha y hora del egreso y la diferencia en horas. Además la hoja queda protegida contra escritura mediante tu contraseña.

Espero te sirva.

Si necesitas aclaraciones o detalles sobre el código me avisás.

Espero tu regalo para mi muy próximo cumpleaños ;-) .

Saludos.

Zyth 02/03/2003 18:47

excelente el macro, sabes donde puedo conseguir un tutorial ?

lmg7 02/03/2003 22:43

Podés probar en La Web del Programador, en Cursos.

Suerte.

tania 03/03/2003 11:38

Hola


Img7 te sacaste un 10!! :arriba:


ciao

alid 05/03/2003 11:38

Gracias lmg7. de aqui en adelante trabajare yo... me sirve mucho...

alid 05/03/2003 11:41

Gracias lmg7. de aqui en adelante trabajare yo... me sirve mucho...

de verda pense que no me responderia nadie...

lmg7 05/03/2003 18:45

Cita:

Mensaje Original por alid
...
de verda pense que no me responderia nadie...

Milagros del FDW :arriba:

A propósito, gracias tania ;-)


La zona horaria es GMT -6. Ahora son las 07:45.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.