Sub t()
Dim wb1 As Workbook, wb2 As Workbook, sh1 As Worksheet, sh2 As Worksheet, c As Range, fn As Range, fPath As String
fPath = ThisWorkbook.Path & "\"
Set wb1 = Workbooks.Open(fPath & "sample1.xls")
Set wb2 = Workbooks.Open(fPath & "sample2.csv")
Set sh1 = wb1.Sheets(1)
Set sh2 = wb2.Sheets(1)
For Each c In sh1.Range("E2", sh1.Cells(Rows.Count, 5).End(xlUp))
If c.Offset(, 8) <> "" Then
Set fn = sh2.Range("C1", sh2.Cells(Rows.Count, 3).End(xlUp)).Find(c.Value, , xlValues, xlWhole)
If Not fn Is Nothing Then
If c.Offset(, 8) < 0 Then
fn.Offset(, 9) = c.Offset(, 10).Value + (c.Offset(, 10) * 0.01)
ElseIf c.Offset(, 8) > 0 Then
fn.Offset(, 9) = c.Offset(, 11).Value - (c.Offset(, 11) * 0.01)
End If
End If
End If
Next
wb1.Close True
wb2.Close True
End Sub
If column E matches with column C and column M has a blank cell then ignore that
If column E of sample1.xls matches with column C of sample2.csv and column M of sample1.xls contains (-) minus sign example(-1.00,-2.00 etc) then see column O of sample1.xls and calculate the 1% of column O of sample1.xls and add the 1% of column O of sample1.xls with itself and paste the result to column L of sample2.csv
Or
If column E of sample1.xls matches with column C of sample2.csv and column M of sample1.xls doesnt contains (-) minus sign example(1.00,2.00 etc) then see column P of sample1.xls calculate the 1% of column P of sample1.xls and subtract 1% of column P of sample1.xls with itself and paste the result to column L of sample2.csv
save and colse all the workbooks
i have to do the same by vba
sample1.xls contains headers in the first row so ignore first row
sample2.csv doesnt contains any headers
vba is placed in a seperate file
all files are located in same place
only 1 file is opened vba code placed file so we have to open the the sample1.xls file and sample2.csv file and then we have to do the process
i have posted the question and then i have deleted the same
i tried to write the code but i got an error and i am not understanding what mistake i have done in this so plz have a look and let me know