Boostez vos compétences Excel avec notre communauté !
Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !
If GetInfoCell And workerinf Then ' F55 07/03/2024
XL.Cells(XLRow, 1) = workerinf
XL.Cells(XLRow, 2) = DateInf
XL.Cells(XLRow, 3) = SI.Cells(CodeRow, j + AmountCol)
Le problème vient de GetInfoCell...Pourriez-vous m'aider ?
Bonjour, le fichier en exemple sauf si confidentiel merci bcp 🙂Bonjour,
En faisant tourner ma macro, j'ai une erreur d'exécution 13 "incompatibilité de type" qui s'affiche et en cliquant sur débogage j'ai ceci surligné mais impossible de trouver d'où vient l'erreur (c'est la 1ere ligne qui est surlignée en jaune)
VB:If GetInfoCell And workerinf Then ' F55 07/03/2024 XL.Cells(XLRow, 1) = workerinf XL.Cells(XLRow, 2) = DateInf XL.Cells(XLRow, 3) = SI.Cells(CodeRow, j + AmountCol)
Pourriez-vous m'aider ?
Bonjour,Bonjour Marie,
Pouvez vous donner un peu plus de code ?
En particulier les déclarations. Que sont XL et SI.
Sub CreateExcelFile()
StrCurrency = "EUR"
frmMSGeneral3D.Show
End Sub
Sub CreateExcelFile_Go(language, CodeRow, DateCol, WorkerCol, _
Level1Col, Level1Def, Level2Col, Level2Def, _
Level3Col, Level3Def, AmountRow, AmountCol, _
TpWorkRow, TpWorkCol, TpLvl1Row, TpLvl1Col, _
TpLvl2Row, TpLvl2Col, TpLvl3Row, TpLvl3Col, _
RSelCol, CSelRow, SSelTxt)
NbSht = Worksheets.Count
'Euro-Bef****************************************
Dim iNbDeci As Integer
If StrCurrency = "BEF" Then
iNbDeci = 2
Else
iNbDeci = 4
End If
'Euro-Bef****************************************
Set XL = Sheets.Add(Sheets(1))
XL.Name = "Saiau-Excel"
Call SaiauTitles(XL, language)
XLRow = 2
For k = 1 To NbSht
Set SI = Sheets(k + 1)
If SSelTxt = "" Then
GetInfoSht = True
Else
If UCase(Left(SI.Name, Len(SSelTxt))) <> UCase(SSelTxt) Then
GetInfoSht = True
Else
GetInfoSht = False
End If
End If
If GetInfoSht Then
If TpWorkRow <> 0 Then
workerinf = SI.Cells(TpWorkRow, TpWorkCol)
End If
If TpLvl1Row <> 0 Then
Level1Inf = SI.Cells(TpLvl1Row, TpLvl1Col)
End If
If TpLvl2Row <> 0 Then
Level2Inf = SI.Cells(TpLvl2Row, TpLvl2Col)
End If
If TpLvl3Row <> 0 Then
Level3Inf = SI.Cells(TpLvl3Row, TpLvl3Col)
End If
Set Tbl = SI.Cells(AmountRow, AmountCol).CurrentRegion
' Lc le 3/12/2008
'NbRow = Tbl.Rows.Count - (AmountRow - 1)
NbRow = Tbl.Rows.Count - 1
NbCol = Tbl.Columns.Count - (AmountCol - 1)
For i = 0 To (NbRow - 1)
If RSelCol = 0 Then
GetInfoRow = True
Else
If SI.Cells(i + AmountRow, RSelCol) = "" Then
GetInfoRow = True
Else
GetInfoRow = False
End If
End If
If GetInfoRow Then
If SI.Cells(i + AmountRow, DateCol) <> "" Then
DateInf = CDate(SI.Cells(i + AmountRow, DateCol))
End If
If WorkerCol <> 0 Then
If SI.Cells(i + AmountRow, WorkerCol) <> "" Then
workerinf = SI.Cells(i + AmountRow, WorkerCol)
Else
If TpWorkRow <> 0 Then
workerinf = SI.Cells(TpWorkRow, TpWorkCol)
End If
End If
End If
If Level1Col <> 0 Then
If SI.Cells(i + AmountRow, Level1Col) <> "" Then
Level1Inf = SI.Cells(i + AmountRow, Level1Col)
Else
If TpLvl1Row <> 0 Then
Level1Inf = SI.Cells(TpLvl1Row, TpLvl1Col)
End If
End If
End If
If Level2Col <> 0 Then
If SI.Cells(i + AmountRow, Level2Col) <> "" Then
Level2Inf = SI.Cells(i + AmountRow, Level2Col)
Else
If TpLvl2Row <> 0 Then
Level2Inf = SI.Cells(TpLvl2Row, TpLvl2Col)
End If
End If
End If
If Level3Col <> 0 Then
If SI.Cells(i + AmountRow, Level3Col) <> "" Then
Level3Inf = SI.Cells(i + AmountRow, Level3Col)
Else
If TpLvl3Row <> 0 Then
Level3Inf = SI.Cells(TpLvl3Row, TpLvl3Col)
End If
End If
End If
For j = 0 To (NbCol - 1)
If SI.Cells(i + AmountRow, j + AmountCol) = "" Then
GetInfoCell = False
Else
If CSelRow = 0 Then
GetInfoCell = True
Else
If SI.Cells(CSelRow, j + AmountCol) = "" Then
GetInfoCell = True
Else
GetInfoCell = False
End If
End If
End If
If GetInfoCell And workerinf Then ' F55 07/03/2024
XL.Cells(XLRow, 1) = workerinf
XL.Cells(XLRow, 2) = DateInf
XL.Cells(XLRow, 3) = SI.Cells(CodeRow, j + AmountCol)
'************************************************
' B.Maes 20/08/2003
' Put numeric display format on result cell.
XL.Cells(XLRow, 4).NumberFormat = "0.00"
' B.Maes 20/08/2003
' By multiplying the contents of the cell by 1, we force a numeric result in the SAIAU-sheet.
' XL.Cells(XLRow, 4) = Application.Round(SI.Cells(i + AmountRow, j + AmountCol) * 1, 2)
valeur = Trim(SI.Cells(i + AmountRow, j + AmountCol))
If valeur = "" Then valeur = 0
XL.Cells(XLRow, 4) = Application.Round(valeur * 1, 2)
'************************************************
If Level1Col <> 0 Then
XL.Cells(XLRow, 5) = Level1Inf
Else
If TpLvl1Row <> 0 Then
XL.Cells(XLRow, 5) = Level1Inf
Else
XL.Cells(XLRow, 5) = Level1Def
End If
End If
If Level2Col <> 0 Then
XL.Cells(XLRow, 6) = Level2Inf
Else
If TpLvl2Row <> 0 Then
XL.Cells(XLRow, 6) = Level2Inf
Else
XL.Cells(XLRow, 6) = Level2Def
End If
End If
If Level3Col <> 0 Then
XL.Cells(XLRow, 7) = Level3Inf
Else
If TpLvl3Row <> 0 Then
XL.Cells(XLRow, 7) = Level3Inf
Else
XL.Cells(XLRow, 7) = Level3Def
End If
End If
XL.Cells(XLRow, 14) = StrCurrency
XLRow = XLRow + 1
End If
Next j
End If
Next i
End If
Next k
For i = 1 To 18
Columns(i).EntireColumn.AutoFit
Next i
End Sub
Sub Automatic()
CreateExcelFile
If OkButton Then
CreateTextFile
End If
End Sub
Des espions ? Qu'est ce que c'est ?Bonsoir.
Mettez des espions sur GetInfoCell et sur workerinf
Vous constaterez probablement que la valeur d'au moins une des deux est d'un type de donnée ne pouvant être converti ni en Boolean ni en Long.
Bonjour, dans l'éditeur VBE touche F9 sur la ligne de code à pisterDes espions ? Qu'est ce que c'est ?
Debug.Print GetInfoCell, workerinf
If GetInfoCell And workerinf Then ' F55 07/03/2024
If GetInfoCell And workerinf Then ' F55 07/03/2024
XL.Cells(XLRow, 1) = workerinf
XL.Cells(XLRow, 2) = DateInf
XL.Cells(XLRow, 3) = SI.Cells(CodeRow, j + AmountCol)
'************************************************
' B.Maes 20/08/2003
' Put numeric display format on result cell.
XL.Cells(XLRow, 4).NumberFormat = "0.00"
' B.Maes 20/08/2003
' By multiplying the contents of the cell by 1, we force a numeric result in the SAIAU-sheet.
' XL.Cells(XLRow, 4) = Application.Round(SI.Cells(i + AmountRow, j + AmountCol) * 1, 2)
valeur = Trim(SI.Cells(i + AmountRow, j + AmountCol))
If valeur = "" Then valeur = 0
XL.Cells(XLRow, 4) = Application.Round(valeur * 1, 2)
Nan, c'pas ça un espion. 😉Bonjour, dans l'éditeur VBE touche F9 sur la ligne de code à pister
Bonjour, Ou'ps super bien vu 🙂 c'est l'habitude qui a pris le dessus...Nan, c'pas ça un espion. 😉
Un espion c'est : clic-droit sur l'expression à espionner puis choisir "Ajouter un espion".
Bonjour,Nan, c'pas ça un espion. 😉
Un espion c'est : clic-droit sur l'expression à espionner puis choisir "Ajouter un espion".
Mais il ne faut pas oublier d'afficher la fenêtre qui affiche les espions.
Sinon, mettre un point d'arrêt sur la ligne fautive, et passer la souris sur l'expression dont on veut connaître la valeur.
We use cookies and similar technologies for the following purposes:
Est ce que vous acceptez les cookies et ces technologies?
We use cookies and similar technologies for the following purposes:
Est ce que vous acceptez les cookies et ces technologies?