tactic6
XLDnaute Impliqué
Bonjour les amis
Sur 2 codes identiques (seul le nombre de données récoltées change) un fonctionne et l'autre me donne l'erreur
Erreur de compilation: variable non définie
Le code qui va bien
Le code qui va pas bien
J'ai beau essayer de déclarer ShArchive12 en tant que Long, String ou autre mais ça ne fonctionne pas
Bizarre non ?
Auriez vous une idée ?
Merci
Sur 2 codes identiques (seul le nombre de données récoltées change) un fonctionne et l'autre me donne l'erreur
Erreur de compilation: variable non définie
Le code qui va bien
VB:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As range, Cancel As Boolean)
Dim Inter As range, LastRow As Long
Dim i As Long, irow As Long
Dim sStr As String, Ar() As String
Worksheets("DEVIS").Select
Dim table() As String
Application.ScreenUpdating = False
sStr = "I6,I5,C12,G8,H9,G10,h12,B15,C15,H15,I15,J15,K15," & _
"B16,C16,H16,I16,J16,K16," & _
"B17,C17,H17,I17,J17,K17,B18,C18,H18,I18,J18,K18," & _
"B19,C19,H19,I19,J19,K19,B20,C20,H20,I20,J20,K20,B21,C21,H21,I21,J21,K21," & _
"B22,C22,H22,I22,J22,K22,B23,C23,H23,I23,J23,K23,B24,C24,H24,I24,J24,K24," & _
"B25,C25,H25,I25,J25,K25,B26,C26,H26,I26,J26,K26,B27,C27,H27,I27,J27,K27," & _
"B28,C28,H28,I28,J28,K28,B29,C29,H29,I29,J29,K29,B30,C30,H30,I30,J30,K30," & _
"B31,C31,H31,I31,J31,K31,B32,C32,H32,I32,J32,K32,B33,C33,H33,I33,J33,K33," & _
"B34,C34,H34,I34,J34,K34,B35,C35,H35,I35,J35,K35,B36,C36,H36,I36,J36,K36," & _
"B37,C37,H37,I37,J37,K37,B38,C38,H38,I38,J38,K38,B39,C39,H39,I39,J39,K39," & _
"B40,C40,H40,I40,J40,K40,B41,C41,H41,I41,J41,K41,B42,C42,H42,I42,J41,K42," & _
"B43,C43,H43,I43,J43,K43,B44,C44,H44,I44,J44,K44,B45,C45,H45,I45,J45,K45," & _
"B46,C46,H46,I46,J46,K46,B47,C47,H47,I47,J47,K47,B48,C48,H48,I48,J48,K48," & _
"B49,C49,H49,I49,J49,K49,B50,C50,H50,I50,J50,K50,B51,C51,H51,I51,J51,K51," & _
"B52,C52,H52,I52,J52,K52,J54,B55,B56,B57,C55,C56,C57," & _
"D55,D56,D57,F58,F59,J55,J56,J57,J58,j59"
Ar = Split(sStr, ",")
LastRow = ShArchive1.range("A" & Rows.Count).End(xlUp).Row
Set Inter = Application.Intersect(Target, ShArchive1.range("A2:A" & LastRow))
If Not Inter Is Nothing Then
If IsEmpty(Target.Value) Then Exit Sub
irow = Target.Row
For i = LBound(Ar) To UBound(Ar)
ShDevis.range(Ar(i)) = ShArchive1.CellS(irow, i + 1).Value
Next i
End If
End Sub
Le code qui va pas bien
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As range, Cancel As Boolean)
Dim Inter As range, LastRow As Long
Dim i As Long, irow As Long
Dim sStr As String, Ar() As String
Worksheets("DEVIS").Select
Dim table() As String
Application.ScreenUpdating = False
sStr = "I6,I5,C12,G8,H9,G10,h12,B15,C15,H15,I15,J15,K15,B16,C16,H16,I16,J16,K16,B17,C17,H17,I17,J17,K17,B18,C18,H18,I18,J18,K18,B19,C19,H19,I19,J19,K19," & _
"B20,C20,H20,I20,J20,K20,B21,C21,H21,I21,J21,K21,B22,C22,H22,I22,J22,K22,B23,C23,H23,I23,J23,K23,B24,C24,H24,I24,J24,K24,B25,C25,H25,I25,J25,K25," & _
"B26,C26,H26,I26,J26,K26,B27,C27,H27,I27,J27,K27,B28,C28,H28,I28,J28,K28,B29,C29,H29,I29,J29,K29,B30,C30,H30,I30,J30,K30,B31,C31,H31,I31,J31,K31," & _
"B32,C32,H32,I32,J32,K32,B33,C33,H33,I33,J33,K33,B34,C34,H34,I34,J34,K34,B35,C35,H35,I35,J35,K35,B36,C36,H36,I36,J36,K36,B37,C37,H37,I37,J37,K37," & _
"B38,C38,H38,I38,J38,K38,B39,C39,H39,I39,J39,K39,B40,C40,H40,I40,J40,K40,B41,C41,H41,I41,J41,K41,B42,C42,H42,I42,J42,K42,B43,C43,H43,I43,J43,K43," & _
"B44,C44,H44,I44,J44,K44,B45,C45,H45,I45,J45,K45,B46,C46,H46,I46,J46,K46,B47,C47,H47,I47,J47,K47,B48,C48,H48,I48,J48,K48,B49,C49,H49,I49,J49,K49," & _
"B50,C50,H50,I50,J50,K50,B51,C51,H51,I51,J51,K51,B52,C52,H52,I52,J52,K52," & _
"B53,C53,H53,I53,J53,K53,B54,C54,H54,I54,J54,K54,B55,C55,H55,I55,J55,K55," & _
"B56,C56,H56,I56,J56,K56,B57,C57,H57,I57,J57,K57,B58,C58,H58,I58,J58,K58," & _
"B59,C59,H59,I59,J59,K59,B85,C85,H85,I85,J85,K85,B86,C86,H86,I86,J86,K86," & _
"B87,C87,H87,I87,J87,K87,B88,C88,H88,I88,J88,K88,B89,C89,H89,I89,J89,K89," & _
"B90,C90,H90,I90,J90,K90,B91,C91,H91,I91,J91,K91,B92,C92,H92,I92,J92,K92," & _
"B93,C93,H93,I93,J93,K93,B94,C94,H94,I94,J94,K94,B95,C95,H95,I95,J95,K95," & _
"B96,C96,H96,I96,J96,K96,B97,C97,H97,I97,J97,K97,B98,C98,H98,I98,J98,K98," & _
"B99,C99,H99,I99,J99,K99,B100,C100,H100,I100,J100,K100,B101,C101,H101,I101,J101,K101," & _
"B102,C102,H102,I102,J102,K102,B103,C103,H103,I103,J103,K103,B104,C104,H104,I104,J104,K104," & _
"B105,C105,H105,I105,J105,K105,B106,C106,H106,I106,J106,K106,B107,C107,H107,I107,J107,K107," & _
"B108,C108,H108,I108,J108,K108,B109,C109,H109,I109,J109,K109,B110,C110,H110,I110,J110,K110," & _
"B111,C111,H111,I111,J111,K111,B112,C112,H112,I112,J112,K112,B113,C113,H113,I113,J113,K113," & _
"B114,C114,H114,I114,J114,K114,B115,C115,H115,I115,J115,K115,B116,C116,H116,I116,J116,K116," & _
"B117,C117,H117,I117,J117,K117,B118,C118,H118,I118,J118,K118,B119,C119,H119,I119,J119,K119," & _
"B120,C120,H120,I120,J120,K120,B121,C121,H121,I121,J121,K121,B122,C122,H122,I122,J122,K122," & _
"C125,C126,C127,D125,D126,D127,F128,F129,J125,J126,J127,J128,j129"
Ar = Split(sStr, ",")
LastRow = ShArchive12.range("A" & Rows.Count).End(xlUp).Row
Set Inter = Application.Intersect(Target, ShArchive12.range("A2:A" & LastRow))
If Not Inter Is Nothing Then
If IsEmpty(Target.Value) Then Exit Sub
irow = Target.Row
For i = LBound(Ar) To UBound(Ar)
ShDevis.range(Ar(i)) = ShArchive12.CellS(irow, i + 1).Value
Next i
End If
End Sub
J'ai beau essayer de déclarer ShArchive12 en tant que Long, String ou autre mais ça ne fonctionne pas
Bizarre non ?
Auriez vous une idée ?
Merci