VBA - Search table column for value, if found move (copy/paste/clear) dates in relevant row to the left.

Chucklez

New Member
Joined
Jul 7, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hey all,

I'm relatively new to VBA and generally just tweak code I find, however I'm struggling with this one.

I have a table with 3 different date columns (Date1, Date2, Date3), and a 4th (DateDiff) which calculates the difference in months between Date1 and Date3. I'm trying to get a code to search the DateDiff column for the value being 6, when found I'm then wanting it copy date2 to date1, date 3 to date2, and clear date3 of the relevant row. Then loop through the rest of the table.

In my head I'm thinking table to an array, and then some sort of find.replace, however I just can't get my head round it.

Thanks in advance for your help!
 

Attachments

  • DateTracker.jpg
    DateTracker.jpg
    18.8 KB · Views: 2

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top