Vba excel
Résolu/Fermé
rah-mani
Messages postés
40
Date d'inscription
mardi 8 décembre 2009
Statut
Membre
Dernière intervention
6 septembre 2011
-
9 déc. 2009 à 11:15
rah-mani Messages postés 40 Date d'inscription mardi 8 décembre 2009 Statut Membre Dernière intervention 6 septembre 2011 - 22 déc. 2009 à 14:18
rah-mani Messages postés 40 Date d'inscription mardi 8 décembre 2009 Statut Membre Dernière intervention 6 septembre 2011 - 22 déc. 2009 à 14:18
A voir également:
- Vba excel
- Liste déroulante excel - Guide
- Si et excel - Guide
- Aller à la ligne excel - Guide
- Word et excel gratuit - Guide
- Excel compter cellule couleur sans vba - Guide
9 réponses
OlivrT
Messages postés
323
Date d'inscription
lundi 2 novembre 2009
Statut
Membre
Dernière intervention
24 mai 2012
36
9 déc. 2009 à 17:02
9 déc. 2009 à 17:02
Bonjour,
c'est un problème de type de données.
Remplacez par ceci :
Dim f As Double , r As Double, x As Double, w As Double, m1 As Double, m2 As Double, m3 As Double, n As Double, j As Double, ro As Double, l As Double, i As Double
Dim v As String, a As String, b As String, c As String, e As String
vous m'excuserez mais si vous codez de la sorte c'est pas étonnant que vous ayez des problèmes de code ...
Donnez des noms logiques à vos variables, exemple pour une chaine commencer par strNomDeLaVariable, pour un Double par dblNomDeLaVariable
Vous ne tenez pas compte non plus du fait que la valeur trouvée ne soit pas dans les plages prévues.
Vous omettez d'initialiser vos variables
etc, ...
c'est un problème de type de données.
Remplacez par ceci :
Dim f As Double , r As Double, x As Double, w As Double, m1 As Double, m2 As Double, m3 As Double, n As Double, j As Double, ro As Double, l As Double, i As Double
Dim v As String, a As String, b As String, c As String, e As String
vous m'excuserez mais si vous codez de la sorte c'est pas étonnant que vous ayez des problèmes de code ...
Donnez des noms logiques à vos variables, exemple pour une chaine commencer par strNomDeLaVariable, pour un Double par dblNomDeLaVariable
Vous ne tenez pas compte non plus du fait que la valeur trouvée ne soit pas dans les plages prévues.
Vous omettez d'initialiser vos variables
etc, ...
rah-mani
Messages postés
40
Date d'inscription
mardi 8 décembre 2009
Statut
Membre
Dernière intervention
6 septembre 2011
11 déc. 2009 à 15:36
11 déc. 2009 à 15:36
Bonjour,
slt tout l mond mon probléme aresoudre mes un pu d'erourr
<souligne>l e problme dans le variabl x ,y,l,e
toujour :
x=""
y=""
l=""
e=""
dim m As String, n As String, ro As Double
Dim v As String, a As String, b As String, e As String, h As String
Dim l As String, y As String, x As String
Dim g As Long
Private Sub CommandButton1_Click()
For g = 6 To 400
ro = 63.6619772
m = Cells(g, 2)
n = Cells(g, 3)
Select Case m
Case Is < 69490
MsgBox "RAHMANI DIT: ERROR"
Case 69494.3795 To 69504.27
v = 141656.551: a = 69494.7106: b = 65733.71783: h = 105.452
Case 69504.271 To 69512.33
v = 141664.551: a = 69502.68121: b = 65733.03355: h = 105.7929
Case 69512.331 To 69520.381
v = 141672.551: a = 69510.64805: b = 65732.3066: h = 106.1157
Case 69520.381 To 69528.424
v = 141680.551: a = 69518.61112: b = 65731.53927: h = 106.4206
Case 69528.424 To 69536.458
v = 141688.551: a = 69526.57042: b = 65730.73381: h = 106.7075
Case 69536.458 To 69544.483
v = 141696.551: a = 69534.52603: b = 65729.89248: h = 106.9765
Case 69544.483 To 69552.499
v = 141704.551: a = 69542.47801: b = 65729.01755: h = 107.2276
Case 69552.499 To 69560.507
v = 141712.551: a = 69550.42649: b = 65728.11126: h = 107.4607
Case 69560.507 To 69568.507
v = 141720.551: a = 69558.37161: b = 65727.17586: h = 107.6759
Case 69568.507 To 69576.499
v = 141728.551: a = 69566.3135: b = 65726.21362: h = 107.8732
Case 69576.499 To 69584.483
v = 141736.551: a = 69574.2524: b = 65725.22677: h = 108.0525
Case 69584.483 To 69592.459
v = 141744.551: a = 69582.1885: b = 65724.21756: h = 108.2139
Case 69592.459 To 69600.428
v = 141752.551: a = 69590.12198: b = 65723.18824: h = 108.3573
Case 69600.428 To 69608.39
v = 141760.551: a = 69598.05314: b = 65722.14104: h = 108.4829
Case 69608.39 To 69616.344
v = 141768.551: a = 69605.98223: b = 65721.07821: h = 108.5905
Case 69616.344 To 69624.293
v = 141776.551: a = 69613.9095: b = 65720.00196: h = 108.6801
Case 69624.293 To 69632.235
v = 141784.551: a = 69621.83525: b = 65718.91456: h = 108.7519
Case 69632.235 To 69640.171
v = 141792.551: a = 69629.75978: b = 65717.81823: h = 108.8056
Case 69640.171 To 69648.102
v = 141800.551: a = 69637.68337: b = 65716.71521: h = 108.8415
Case 69648.102 To 69656.027
v = 141808.551: a = 69645.60634: b = 65715.60772: h = 108.8594
Case Is > 69715.60772
MsgBox "RAHMANI DIT: ERROR"
End Select
x = m - a
y = n - b
l = ro * Atn((x) / (y))
If y < 0 Then
l = l + 200
ElseIf l < 0 Then l = l + 400
End If
e = Sqr(x ^ 2 + n ^ 2)
Cells(g, 5) = v + (Cos((l - h)) * e)
Cells(g, 6) = Sin((l - h)) * e
Next g
End Sub
slt tout l mond mon probléme aresoudre mes un pu d'erourr
<souligne>l e problme dans le variabl x ,y,l,e
toujour :
x=""
y=""
l=""
e=""
dim m As String, n As String, ro As Double
Dim v As String, a As String, b As String, e As String, h As String
Dim l As String, y As String, x As String
Dim g As Long
Private Sub CommandButton1_Click()
For g = 6 To 400
ro = 63.6619772
m = Cells(g, 2)
n = Cells(g, 3)
Select Case m
Case Is < 69490
MsgBox "RAHMANI DIT: ERROR"
Case 69494.3795 To 69504.27
v = 141656.551: a = 69494.7106: b = 65733.71783: h = 105.452
Case 69504.271 To 69512.33
v = 141664.551: a = 69502.68121: b = 65733.03355: h = 105.7929
Case 69512.331 To 69520.381
v = 141672.551: a = 69510.64805: b = 65732.3066: h = 106.1157
Case 69520.381 To 69528.424
v = 141680.551: a = 69518.61112: b = 65731.53927: h = 106.4206
Case 69528.424 To 69536.458
v = 141688.551: a = 69526.57042: b = 65730.73381: h = 106.7075
Case 69536.458 To 69544.483
v = 141696.551: a = 69534.52603: b = 65729.89248: h = 106.9765
Case 69544.483 To 69552.499
v = 141704.551: a = 69542.47801: b = 65729.01755: h = 107.2276
Case 69552.499 To 69560.507
v = 141712.551: a = 69550.42649: b = 65728.11126: h = 107.4607
Case 69560.507 To 69568.507
v = 141720.551: a = 69558.37161: b = 65727.17586: h = 107.6759
Case 69568.507 To 69576.499
v = 141728.551: a = 69566.3135: b = 65726.21362: h = 107.8732
Case 69576.499 To 69584.483
v = 141736.551: a = 69574.2524: b = 65725.22677: h = 108.0525
Case 69584.483 To 69592.459
v = 141744.551: a = 69582.1885: b = 65724.21756: h = 108.2139
Case 69592.459 To 69600.428
v = 141752.551: a = 69590.12198: b = 65723.18824: h = 108.3573
Case 69600.428 To 69608.39
v = 141760.551: a = 69598.05314: b = 65722.14104: h = 108.4829
Case 69608.39 To 69616.344
v = 141768.551: a = 69605.98223: b = 65721.07821: h = 108.5905
Case 69616.344 To 69624.293
v = 141776.551: a = 69613.9095: b = 65720.00196: h = 108.6801
Case 69624.293 To 69632.235
v = 141784.551: a = 69621.83525: b = 65718.91456: h = 108.7519
Case 69632.235 To 69640.171
v = 141792.551: a = 69629.75978: b = 65717.81823: h = 108.8056
Case 69640.171 To 69648.102
v = 141800.551: a = 69637.68337: b = 65716.71521: h = 108.8415
Case 69648.102 To 69656.027
v = 141808.551: a = 69645.60634: b = 65715.60772: h = 108.8594
Case Is > 69715.60772
MsgBox "RAHMANI DIT: ERROR"
End Select
x = m - a
y = n - b
l = ro * Atn((x) / (y))
If y < 0 Then
l = l + 200
ElseIf l < 0 Then l = l + 400
End If
e = Sqr(x ^ 2 + n ^ 2)
Cells(g, 5) = v + (Cos((l - h)) * e)
Cells(g, 6) = Sin((l - h)) * e
Next g
End Sub
rah-mani
Messages postés
40
Date d'inscription
mardi 8 décembre 2009
Statut
Membre
Dernière intervention
6 septembre 2011
11 déc. 2009 à 16:13
11 déc. 2009 à 16:13
Dim m As String, n As String, ro As Double
Dim v As String, a As String, b As String, e As String, h As String
Dim l As String, y As String, x As String
Dim g As Long
L probléme dans x,y,l,e
X= » »
Y= » »
E= » »
L= » »
Private Sub CommandButton1_Click()
For g = 6 To 400
ro = 63.6619772
m = Cells(g, 2)
n = Cells(g, 3)
Select Case m
Case Is < 69490
MsgBox "RAHMANI DIT: ERROR"
Case 69494.3795 To 69504.27
v = 141656.551: a = 69494.7106: b = 65733.71783: h = 105.452
Case 69504.271 To 69512.33
v = 141664.551: a = 69502.68121: b = 65733.03355: h = 105.7929
Case 69512.331 To 69520.381
v = 141672.551: a = 69510.64805: b = 65732.3066: h = 106.1157
Case 69520.381 To 69528.424
v = 141680.551: a = 69518.61112: b = 65731.53927: h = 106.4206
Case 69528.424 To 69536.458
v = 141688.551: a = 69526.57042: b = 65730.73381: h = 106.7075
Case 69536.458 To 69544.483
v = 141696.551: a = 69534.52603: b = 65729.89248: h = 106.9765
Case 69544.483 To 69552.499
v = 141704.551: a = 69542.47801: b = 65729.01755: h = 107.2276
Case 69552.499 To 69560.507
v = 141712.551: a = 69550.42649: b = 65728.11126: h = 107.4607
Case 69560.507 To 69568.507
v = 141720.551: a = 69558.37161: b = 65727.17586: h = 107.6759
Case 69568.507 To 69576.499
v = 141728.551: a = 69566.3135: b = 65726.21362: h = 107.8732
Case 69576.499 To 69584.483
v = 141736.551: a = 69574.2524: b = 65725.22677: h = 108.0525
Case 69584.483 To 69592.459
v = 141744.551: a = 69582.1885: b = 65724.21756: h = 108.2139
Case 69592.459 To 69600.428
v = 141752.551: a = 69590.12198: b = 65723.18824: h = 108.3573
Case 69600.428 To 69608.39
v = 141760.551: a = 69598.05314: b = 65722.14104: h = 108.4829
Case 69608.39 To 69616.344
v = 141768.551: a = 69605.98223: b = 65721.07821: h = 108.5905
Case 69616.344 To 69624.293
v = 141776.551: a = 69613.9095: b = 65720.00196: h = 108.6801
Case 69624.293 To 69632.235
v = 141784.551: a = 69621.83525: b = 65718.91456: h = 108.7519
Case 69632.235 To 69640.171
v = 141792.551: a = 69629.75978: b = 65717.81823: h = 108.8056
Case 69640.171 To 69648.102
v = 141800.551: a = 69637.68337: b = 65716.71521: h = 108.8415
Case 69648.102 To 69656.027
v = 141808.551: a = 69645.60634: b = 65715.60772: h = 108.8594
Case Is > 69715.60772
MsgBox "RAHMANI DIT: ERROR"
End Select
x = m - a
y = n - b
l = ro * Atn((x) / (y))
If y < 0 Then
l = l + 200
ElseIf l < 0 Then l = l + 400
End If
e = Sqr(x ^ 2 + n ^ 2)
Cells(g, 5) = v + (Cos((l - h)) * e)
Cells(g, 6) = Sin((l - h)) * e
Next g
End Sub
Dim v As String, a As String, b As String, e As String, h As String
Dim l As String, y As String, x As String
Dim g As Long
L probléme dans x,y,l,e
X= » »
Y= » »
E= » »
L= » »
Private Sub CommandButton1_Click()
For g = 6 To 400
ro = 63.6619772
m = Cells(g, 2)
n = Cells(g, 3)
Select Case m
Case Is < 69490
MsgBox "RAHMANI DIT: ERROR"
Case 69494.3795 To 69504.27
v = 141656.551: a = 69494.7106: b = 65733.71783: h = 105.452
Case 69504.271 To 69512.33
v = 141664.551: a = 69502.68121: b = 65733.03355: h = 105.7929
Case 69512.331 To 69520.381
v = 141672.551: a = 69510.64805: b = 65732.3066: h = 106.1157
Case 69520.381 To 69528.424
v = 141680.551: a = 69518.61112: b = 65731.53927: h = 106.4206
Case 69528.424 To 69536.458
v = 141688.551: a = 69526.57042: b = 65730.73381: h = 106.7075
Case 69536.458 To 69544.483
v = 141696.551: a = 69534.52603: b = 65729.89248: h = 106.9765
Case 69544.483 To 69552.499
v = 141704.551: a = 69542.47801: b = 65729.01755: h = 107.2276
Case 69552.499 To 69560.507
v = 141712.551: a = 69550.42649: b = 65728.11126: h = 107.4607
Case 69560.507 To 69568.507
v = 141720.551: a = 69558.37161: b = 65727.17586: h = 107.6759
Case 69568.507 To 69576.499
v = 141728.551: a = 69566.3135: b = 65726.21362: h = 107.8732
Case 69576.499 To 69584.483
v = 141736.551: a = 69574.2524: b = 65725.22677: h = 108.0525
Case 69584.483 To 69592.459
v = 141744.551: a = 69582.1885: b = 65724.21756: h = 108.2139
Case 69592.459 To 69600.428
v = 141752.551: a = 69590.12198: b = 65723.18824: h = 108.3573
Case 69600.428 To 69608.39
v = 141760.551: a = 69598.05314: b = 65722.14104: h = 108.4829
Case 69608.39 To 69616.344
v = 141768.551: a = 69605.98223: b = 65721.07821: h = 108.5905
Case 69616.344 To 69624.293
v = 141776.551: a = 69613.9095: b = 65720.00196: h = 108.6801
Case 69624.293 To 69632.235
v = 141784.551: a = 69621.83525: b = 65718.91456: h = 108.7519
Case 69632.235 To 69640.171
v = 141792.551: a = 69629.75978: b = 65717.81823: h = 108.8056
Case 69640.171 To 69648.102
v = 141800.551: a = 69637.68337: b = 65716.71521: h = 108.8415
Case 69648.102 To 69656.027
v = 141808.551: a = 69645.60634: b = 65715.60772: h = 108.8594
Case Is > 69715.60772
MsgBox "RAHMANI DIT: ERROR"
End Select
x = m - a
y = n - b
l = ro * Atn((x) / (y))
If y < 0 Then
l = l + 200
ElseIf l < 0 Then l = l + 400
End If
e = Sqr(x ^ 2 + n ^ 2)
Cells(g, 5) = v + (Cos((l - h)) * e)
Cells(g, 6) = Sin((l - h)) * e
Next g
End Sub
rah-mani
Messages postés
40
Date d'inscription
mardi 8 décembre 2009
Statut
Membre
Dernière intervention
6 septembre 2011
11 déc. 2009 à 16:15
11 déc. 2009 à 16:15
L probléme dans x,y,l,e
X= ""
Y= ""
E= ""
L= ""
X= ""
Y= ""
E= ""
L= ""
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
rah-mani
Messages postés
40
Date d'inscription
mardi 8 décembre 2009
Statut
Membre
Dernière intervention
6 septembre 2011
12 déc. 2009 à 14:28
12 déc. 2009 à 14:28
Dim l As String, y As String, x As String au varible
OlivrT
Messages postés
323
Date d'inscription
lundi 2 novembre 2009
Statut
Membre
Dernière intervention
24 mai 2012
36
21 déc. 2009 à 09:23
21 déc. 2009 à 09:23
Bonjour, me revoilà après quelques jours d'absence.
Le problème, j'insiste, persiste et signe est un problème de déclaration de type de données.
Si vous mettez le résultat d'une division dans une string, exemple a = 6 / 2, dans une String, le résultat sera "3" et pas 3 ... donc dans le Case cela ne fonctionnera pas.
Votre macro fonctionne si vous mettez ceci :
Dim f As Double, r As Double, x As Double,
w As Double, m1 As Double, m2 As Double, m3 As Double, n As Double, j As Double, ro As Double, l As Double, i As Double
Le problème, j'insiste, persiste et signe est un problème de déclaration de type de données.
Si vous mettez le résultat d'une division dans une string, exemple a = 6 / 2, dans une String, le résultat sera "3" et pas 3 ... donc dans le Case cela ne fonctionnera pas.
Votre macro fonctionne si vous mettez ceci :
Dim f As Double, r As Double, x As Double,
w As Double, m1 As Double, m2 As Double, m3 As Double, n As Double, j As Double, ro As Double, l As Double, i As Double
eriiic
Messages postés
24601
Date d'inscription
mardi 11 septembre 2007
Statut
Contributeur
Dernière intervention
25 novembre 2024
7 243
21 déc. 2009 à 09:43
21 déc. 2009 à 09:43
Bonjour OlivrT,
Il n'est pas pire sourd que celui qui ne veut entendre...
Voir ici
Il n'est pas pire sourd que celui qui ne veut entendre...
Voir ici
OlivrT
Messages postés
323
Date d'inscription
lundi 2 novembre 2009
Statut
Membre
Dernière intervention
24 mai 2012
36
21 déc. 2009 à 10:32
21 déc. 2009 à 10:32
ah il est têtu le gars ! :-)
rah-mani
Messages postés
40
Date d'inscription
mardi 8 décembre 2009
Statut
Membre
Dernière intervention
6 septembre 2011
22 déc. 2009 à 14:18
22 déc. 2009 à 14:18
merci pour tou 100 merci
j'ai resoudr mon probleme
j'ai resoudr mon probleme