[Solved] calculation using cell address

bigme

Member
dear friends,
please help me on this matter.
i have 2 sheets, in sheet1 contain the Max value address and a number, in sheet2 a column contain several number and a column for result
i need to do a VBA calculation in sheet2 to the MAX value so the result equal with value in sheet1 using copy special paste add, thank you.
note : there are 2 condition depend on the value on column D in sheet1

Capture.JPG


thank you for the assist....
regards,
bigMe
 
dear friends,
please help me on this matter.
i have 2 sheets, in sheet1 contain the Max value address and a number, in sheet2 a column contain several number and a column for result
i need to do a VBA calculation in sheet2 to the MAX value so the result equal with value in sheet1 using copy special paste add, thank you.
note : there are 2 condition depend on the value on column D in sheet1

View attachment 198


thank you for the assist....
regards,
bigMe
Hello Bigme,

I came across your comment on our platform and am glad to inform you that I have an exciting solution for your issue. I understand you were looking for help finding and matching the max value with the value in Sheet1. Next, you want to subtract the Value to Synchronize from the corresponding max values in Sheet2. I am pleased to have implemented a solution to address your needs using the Excel VBA code.

Code:
Sub SubtractSynValues()
    
    Dim wb As Workbook
    Dim ws1 As Worksheet, ws2 As Worksheet
    Dim lastRow As Long, i As Long
    Dim cellAddress As String, synValue As Double
    
    Set wb = ActiveWorkbook
    Set ws1 = wb.Worksheets("Sheet1")
    Set ws2 = wb.Worksheets("Sheet2")
    
    lastRow = ws1.Cells(ws1.Rows.Count, "B").End(xlUp).Row

    For i = 3 To lastRow

        cellAddress = ws1.Cells(i, "B").Value
        synValue = ws1.Cells(i, "D").Value
        ws2.Range(cellAddress).Value = ws2.Range(cellAddress).Value - synValue

    Next i

End Sub

INPUT:

Bigme(INPUT).png

OUTPUT:

Bigme(OUTPUT).png

Thank you for reaching out to us, and I would like to share the solution Workbook with you. Please let me know if you have any further questions or if there's anything else I can assist you with.

Best regards,
Lutfor Rahman Shimanto
 

Attachments

thank you very much for the assist, it really helpful :love:

best regards,
bigMe
Dear Bigme,

It's fantastic to hear that you found my support to be beneficial. Thank you for your kind comments. Feel free to contact us again with any other inquiries or concerns.

Sincere Regards,
Lutfor Rahman Shimanto (ExcelDemy Team)
 

Online statistics

Members online
0
Guests online
1,264
Total visitors
1,264

Forum statistics

Threads
456
Messages
2,020
Members
1,885
Latest member
gamebaihealth
Back
Top