VBA code compare date and copy cell

Jd1uth

New Member
Joined
Sep 17, 2024
Messages
12
Office Version
  1. 2013
Platform
  1. Windows
Hallo I need some help with a vba code or formula
i need code that compare date on sheet2 a1 with date in collom A on sheet planning
when date (30-9-2024) is the same it copy collomn L1 (text A) to sheet2 C12
When date (7-10-2024) match date on sheet2 1A in copy (text B) collomn L6 to sheet2 F 12
etc.


sheet Planning
Forum.xlsx
ABCDEFGHIJKLMNOP
130-9-2024A
2
3
4
5
67-10-2024B
7
8
9
10
1114-10-2024C
12
13
14
15
1621-10-2024D
17
18
19
20
2128-10-2024E
22
23
24
25
264-11-2024F
27
28
29
planning
Cell Formulas
RangeFormula
A6,A26,A21,A16,A11A6=A1+7

Sheet 2
Forum.xlsx
ABCDEFGHIJKLMNOPQRST
130-9-2024
2Date that change
3
4
5
6
7
8
9
10
11
12ABCDEF
13
14
15
16
17
18
19
20
Sheet2
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I found this code Made by DanteAmor that does A part of that what I want but I dont now how to modify it so it will work for me

VBA Code:
Sub findAndCopy()
  Dim foundCell As Range, sh1, sh2 As Worksheet
 
  'Set sheets
  Set sh1 = Sheets("Planning")
  Set sh2 = Sheets("Sheet2")
 
  'Find string in column C of Sheet2
  Set foundCell = sh2.Range("A1").Find(sh1.Range("A:A").Value, , xlValues, xlWhole)
  If Not foundCell Is Nothing Then 'If match cell is found
    sh1.Range("L:L").Copy
    foundCell.PasteSpecial xlPasteValues
    foundCell.PasteSpecial xlPasteFormats
    Application.CutCopyMode = False
  Else
    Call MsgBox("Not found the match cell!", vbExclamation, "Finding String")
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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