macro excel
Page 1 sur 1
macro excel
Function SurfaceRectangle(Longueur, Largeur)
SurfaceRectangle = Longueur * Largeur
End Function
Sub MaMacro()
Dim Annee As Integer
Range("A1").Select
Annee = ActiveCell.FormulaR1C1
MsgBox Annee * 365
End Sub
Sub Change()
Dim be, all, esp, fr, gr, irl, ita As Double
Dim somme As Double
Dim pays As String
Range("A4").Select
be = Selection.Cells.Value
Range("B4").Select
all = Selection.Cells.Value
Range("C4").Select
esp = Selection.Cells.Value
Range("D4").Select
fr = Selection.Cells.Value
Range("E4").Select
gr = Selection.Cells.Value
Range("F4").Select
irl = Selection.Cells.Value
Range("G4").Select
ita = Selection.Cells.Value
somme = InputBox("Entrez la somme à convertir (En cas de nombres décimaux, la séparation doit être une virgules et non un point)")
pays = InputBox("Entrez les 3 lettres du pays en majuscule (ligne3)")
If pays = "BEF" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "DEM" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "ESP" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "FRF" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "GRD" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "IEP" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "ITL" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
End If
End Sub
Sub MaMacro()
Dim Ligne, Colone As Integer
Dim Nom, Prenom, Password As String
Colone = 1
Ligne = 2
Do While Cells(Ligne, 1).Value <> ""
Nom = Cells(Ligne, Colonne)
Colone = Colone + 1
Prenom = Cells(Ligne, Colonne)
Colone = Colone + 1
Password = Cells(Ligne, Colonne)
MsgBox Nom & " " & Prenom & " " & Password
Ligne = Ligne + 1
Colone = 1
Loop
Shell "cmd.exe /K C:\Users\Admin5B\Desktop\test.bat" & " " & Nom & " " & Prenom & " " & Password
End Sub
SCRIPT : @echo Nom:%1.
@echo Prenom:%2.
@echo Mot de passe:%3.
Ex sup prepa 1
Sub exsup1()
Dim Ligne, Colonne As Integer
Dim Nom, Prenom, Password As String
Colonne = 1
Ligne = 2
Do While Cells(Ligne, 1).Value <> ""
Nom = Cells(Ligne, Colonne)
Colonne = Colonne + 1
Prenom = Cells(Ligne, Colonne)
Colonne = Colonne + 1
Password = Cells(Ligne, Colonne)
MsgBox Nom & " " & Prenom & " " & Password
Ligne = Ligne + 1
Colonne = 1
Shell "cmd.exe /K C:\Users\Admin5B\Desktop\test.bat" & " " & Nom & " " & Prenom & " " & Password
Loop
End Sub
SCRIPT : @echo Nom:%1.
@echo Prenom:%2.
@echo Mot de passe:%3.
net user %1%2 %3 /add
Ex sup prepa 2
Function SurfaceCercle(Rayon)
SurfaceRectangle = Rayon * Rayon * 3.14
End Function
Ex sup prepra 3
Sub calculette()
Dim nombre1, nombre2 As Integer
Dim resultataddition, resultatsoustraction, resultatmultiplication As Integer
nombre1 = InputBox("entrez le nombre1")
nombre2 = InputBox("entrez le nombre2")
MsgBox addition(nombre1, nombre2)
MsgBox soustraction(nombre1, nombre2)
MsgBox multiplication(nombre1, nombre2)
Shell "cmd.exe /K C:\Users\Admin5B\Desktop\exprepa3.bat" & " " & addition(nombre1, nombre2) & " " & soustraction(nombre1, nombre2) & " " & multiplication(nombre1, nombre2)
End Sub
Function addition(nombre1, nombre2)
addition = nombre1 + nombre2
End Function
Function soustraction(nombre1, nombre2)
soustraction = nombre1 - nombre2
End Function
Function multiplication(nombre1, nombre2)
multiplication = nombre1 * nombre2
End Function
SCRIPT :
@echo Addition:%1
@echo Soustraction:%2
@echo Multiplication:%3
cmd
SurfaceRectangle = Longueur * Largeur
End Function
Sub MaMacro()
Dim Annee As Integer
Range("A1").Select
Annee = ActiveCell.FormulaR1C1
MsgBox Annee * 365
End Sub
Sub Change()
Dim be, all, esp, fr, gr, irl, ita As Double
Dim somme As Double
Dim pays As String
Range("A4").Select
be = Selection.Cells.Value
Range("B4").Select
all = Selection.Cells.Value
Range("C4").Select
esp = Selection.Cells.Value
Range("D4").Select
fr = Selection.Cells.Value
Range("E4").Select
gr = Selection.Cells.Value
Range("F4").Select
irl = Selection.Cells.Value
Range("G4").Select
ita = Selection.Cells.Value
somme = InputBox("Entrez la somme à convertir (En cas de nombres décimaux, la séparation doit être une virgules et non un point)")
pays = InputBox("Entrez les 3 lettres du pays en majuscule (ligne3)")
If pays = "BEF" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "DEM" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "ESP" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "FRF" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "GRD" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "IEP" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
ElseIf pays = "ITL" Then
MsgBox " " & Round(somme / be, 2) & " Euro(s)"
End If
End Sub
Sub MaMacro()
Dim Ligne, Colone As Integer
Dim Nom, Prenom, Password As String
Colone = 1
Ligne = 2
Do While Cells(Ligne, 1).Value <> ""
Nom = Cells(Ligne, Colonne)
Colone = Colone + 1
Prenom = Cells(Ligne, Colonne)
Colone = Colone + 1
Password = Cells(Ligne, Colonne)
MsgBox Nom & " " & Prenom & " " & Password
Ligne = Ligne + 1
Colone = 1
Loop
Shell "cmd.exe /K C:\Users\Admin5B\Desktop\test.bat" & " " & Nom & " " & Prenom & " " & Password
End Sub
SCRIPT : @echo Nom:%1.
@echo Prenom:%2.
@echo Mot de passe:%3.
Ex sup prepa 1
Sub exsup1()
Dim Ligne, Colonne As Integer
Dim Nom, Prenom, Password As String
Colonne = 1
Ligne = 2
Do While Cells(Ligne, 1).Value <> ""
Nom = Cells(Ligne, Colonne)
Colonne = Colonne + 1
Prenom = Cells(Ligne, Colonne)
Colonne = Colonne + 1
Password = Cells(Ligne, Colonne)
MsgBox Nom & " " & Prenom & " " & Password
Ligne = Ligne + 1
Colonne = 1
Shell "cmd.exe /K C:\Users\Admin5B\Desktop\test.bat" & " " & Nom & " " & Prenom & " " & Password
Loop
End Sub
SCRIPT : @echo Nom:%1.
@echo Prenom:%2.
@echo Mot de passe:%3.
net user %1%2 %3 /add
Ex sup prepa 2
Function SurfaceCercle(Rayon)
SurfaceRectangle = Rayon * Rayon * 3.14
End Function
Ex sup prepra 3
Sub calculette()
Dim nombre1, nombre2 As Integer
Dim resultataddition, resultatsoustraction, resultatmultiplication As Integer
nombre1 = InputBox("entrez le nombre1")
nombre2 = InputBox("entrez le nombre2")
MsgBox addition(nombre1, nombre2)
MsgBox soustraction(nombre1, nombre2)
MsgBox multiplication(nombre1, nombre2)
Shell "cmd.exe /K C:\Users\Admin5B\Desktop\exprepa3.bat" & " " & addition(nombre1, nombre2) & " " & soustraction(nombre1, nombre2) & " " & multiplication(nombre1, nombre2)
End Sub
Function addition(nombre1, nombre2)
addition = nombre1 + nombre2
End Function
Function soustraction(nombre1, nombre2)
soustraction = nombre1 - nombre2
End Function
Function multiplication(nombre1, nombre2)
multiplication = nombre1 * nombre2
End Function
SCRIPT :
@echo Addition:%1
@echo Soustraction:%2
@echo Multiplication:%3
cmd
jeanhubert- Messages : 5
Date d'inscription : 27/03/2018
Page 1 sur 1
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|