XL 2010 conversion en nombre depuis vba

gh4

XLDnaute Occasionnel
Bonjour a tous et toutes,
petit souci avec une macro et je n'y arrive pas malgré mes recherches

j'ecris dans une cellule par le resultat d'une textbox
cells (lign-1,1)=textbox1
le resultat dans la cellule colon 5 de la feuille ne se met pas au format nombre et m’empêche de faire des calculs avec une autre cellule avec mise en forme conditionnelle colon 4

voici un bout de la macro dans le userform

Sheets("stock general").Cells(lign + 1, 4).Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
Formula1:="=$E3"
Selection.FormatConditions(1).Interior.ColorIndex = 35
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:="=$E3"
Selection.FormatConditions(2).Interior.ColorIndex = 3

With ActiveSheet.Columns(4)
.NumberFormat = "General"
.TextToColumns DataType:=xlDelimited, FieldInfo:=Array(1, 1)
End With

'Sheets("stock general").Cells(lign + 1, 5).Select
' With ActiveSheet.Columns(4)
' .NumberFormat = "General"
' .TextToColumns DataType:=xlDelimited, FieldInfo:=Array(1, 1)
'End With

'With Selection
' Selection.NumberFormat = "0"
'End With




Cells(lign + 1, 1) = TextBox1
Cells(lign + 1, 2) = TextBox2

Cells(lign + 1, 3) = TextBox3
Cells(lign + 1, 5) = TextBox4

par avance je vous remercie pour votre aide
 

JM27

XLDnaute Barbatruc
bonjour
un textbox renvoie du texte : normal
exemple ( a condition que dans la textbox , il y a une valeur qui peut être transformée en numérique, sinon plantage , réaliser une gestion d'erreur)
Cells(lign + 1, 1) = cdbl(TextBox1)
 

Statistiques des forums

Discussions
311 711
Messages
2 081 799
Membres
101 818
dernier inscrit
tiftouf5757