Link to home
Start Free TrialLog in
Avatar of rdy123 rdy
rdy123 rdy

asked on

vba code to update data as per criteria

Example.xlsxHi,

i am trying for vba code for below criteria,

1. in sheet1 i am filtering for column D for dates i want and copy mail id of column H
2. goto sheet 2 and find that mail id in column D, now according to the column C in sheet1 confirmed and cancelled i would like to enter the registration as yes if confirmed
    and for cancelled as cancelled in sheet2
3.update the offering date(column F-sheet2) as event start date(column B-sheet1) for yes
4.update comments only for cancelled as "Cancelled on 10/04/2018(column E date-sheet1) from the 16/04/2018(column B-sheet1) offering"

Please suggest.

Thank you in advance.
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Hi,

Why you need VBA to perform such simple update?

If you copy Event Title Column from Sheet1 to Programme Title Column in Sheet2, rest can be updated with formula. Check in attached...
rdy123rdy_Update-Sheet2.xlsx
Avatar of rdy123 rdy
rdy123 rdy

ASKER

Thank you Shums.

As the file always gets updated, i would like to do it in VBA.

i added Browse option in vba code inorder to use updated version always.
I understand, but did you check the formulated version file I posted?

Whenever Sheet1 is updated, you just need to copy Event Title from Sheet1 and paste it to Programme Name in Sheet2, then drag down the formula as long you need.
If your concern is just to update the Remarks Column, then you can just add below formula in Column I, Title it with Remarks

=IF($A2="","",IF(VLOOKUP($A2,$A:$H,3,0)="Confirmed","","Cancelled on "&TEXT(VLOOKUP($A2,$A:$H,5,0),"dd/mm/yyyy")&" from the "&TEXT(VLOOKUP($A2,$A:$H,2,0),"dd/mm/yyyy")&" offering"))

Check in attached...
rdy123rdy_Update-Sheet2_v2.xlsx
Actually there are 2 different worksheets, sheet1 is one worksheet and sheet2 is one worksheet for example i gave in 1 worksheet with 2 sheet tabs.
i have 4 different files similar way, so thought it would be good if i give it in vba.

i will try if these formulas can be added in vba.

Thanks again.
ASKER CERTIFIED SOLUTION
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Shums, will check and get back to you :)
No further comments been added. :(