i am writing code to update spreadsheet cell value with intersect function. i have below code that search UserForm3.txtchangenumber in range I1 to AZA1 (worksheet "Cost") and search userform1.txtselectedpart in range E4 to E250(worksheet "Cost"). i would like to populate cell in (worksheet "Cost") when both search intersect by using intersect function.
below is code what i have right now. but it gives me run time erroe 1004 method range of object _global failed.
can you pl help me to understand what is error by correcting below code.
Code:
[CODE=vba]Private Sub txtdelta_AfterUpdate()
Dim vrech As Range
Dim lColumn As Range
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Cost")
'Dim colonne As Long
'colonne = Me.ComboBox1.Value
Set lColumn = sh.Range("i2:AZa2").Find(UserForm3.txtchangenumber, , xlValues, xlWhole) 'LookIn:=xlValues)
Set vrech = sh.Range("E4:E250").Find(UserForm1.txtselectedpart, , xlValues, xlWhole) 'LookIn:=xlValues)
Intersect(Range("vrech"), Range("col")) = UserForm1.txtdelta.Value
End Sub
Bookmarks