martes, 28 de diciembre de 2010
domingo, 24 de octubre de 2010
Colorear código para ponerlo en la web
Esta dirección es de gran utilidad y trae muchos lenguajes:
http://www.scourdesign.com/articulos/tutoriales/colorear/index.php
http://www.scourdesign.com/articulos/tutoriales/colorear/index.php
Desordenar una columna de valores en Excel
Sub Desordenar() Dim rango As Range Set rango = Selection.Cells For i = 1 To rango.Rows.Count Dim aleatorio As Integer Dim cadena As String rango.Rows(i).Select cadena = ActiveCell.FormulaR1C1 aleatorio = Int(Rnd() * rango.Rows.Count) + 1 rango.Rows(i).FormulaR1C1 = rango.Rows_
(aleatorio).FormulaR1C1 rango.Cells(aleatorio).FormulaR1C1 = cadena Next End Sub
jueves, 26 de agosto de 2010
Ejecutar varios programas al mismo tiempo en VBS
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "Ruta1" & Chr(34), 0
WshShell.Run chr(34) & "Ruta2" & Chr(34), 0
WshShell.Run chr(34) & "Ruta3" & Chr(34), 0
WshShell.Run chr(34) & "Ruta1" & Chr(34), 0
WshShell.Run chr(34) & "Ruta2" & Chr(34), 0
WshShell.Run chr(34) & "Ruta3" & Chr(34), 0
miércoles, 19 de mayo de 2010
Crear muchas carpetas en vbs
'Crea las carpetas desde Equipo1 a Equipo100
'El archivo se guarda con extensión vbs y adelante.
Dim fso, fldr, i
Set fso = CreateObject("Scripting.FileSystemObject")
for i=1 to 100
Set fldr = fso.CreateFolder("Equipo" & i)
next
'El archivo se guarda con extensión vbs y adelante.
Dim fso, fldr, i
Set fso = CreateObject("Scripting.FileSystemObject")
for i=1 to 100
Set fldr = fso.CreateFolder("Equipo" & i)
next
jueves, 4 de diciembre de 2008
VBA Excel: Brain Training
Sub InventarOperaciones()
Dim i As Integer
Dim NumOperaciones As Integer
Dim operacion As String
NumOperaciones = 10
For i = 1 To NumOperaciones
Cells(i, 1) = Int((Rnd * 10) + 1)
operacion = Int((Rnd * 3) + 1)
If operacion = "1" Then operacion = "+"
If operacion = "2" Then operacion = "-"
If operacion = "3" Then operacion = "*"
Cells(i, 2) = operacion
Cells(i, 3) = Int((Rnd * 10) + 1)
Cells(i, 4) = ""
Cells(i, 5) = ""
Next
Cells(1, 4).Select
End Sub
Sub ComprobarOperaciones()
Dim i As Integer
Dim NumOperaciones As Integer
Dim operacion As String
Dim resultado As Integer
Dim puntos As Integer
NumOperaciones = 10
puntos = 0
For i = 1 To NumOperaciones
operacion = Cells(i, 2)
If operacion = "+" Then resultado = Cells(i, 1) + Cells(i, 3)
If operacion = "-" Then resultado = Cells(i, 1) - Cells(i, 3)
If operacion = "*" Then resultado = Cells(i, 1) * Cells(i, 3)
If Cells(i, 4) = resultado Then
Cells(i, 5) = "OK"
puntos = puntos + 1
Else
Cells(i, 5) = resultado
End If
Next
MsgBox "PUNTOS:" & puntos
End Sub
martes, 2 de diciembre de 2008
Access VBA: Realizar una consulta por código
Private Sub tipo_AfterUpdate()
Dim r As DAO.Recordset
Dim db As DAO.Database
Dim SQL As String
Set db = CurrentDb
SQL = "select * from servicios where codservicio=" & tipo
Set r = db.OpenRecordset(SQL)
descripcion = r(1)
precio = r(2)
End Sub
Suscribirse a:
Entradas (Atom)