I have a small part of a macro where it copies a date range from one place to another. And I would like it to add another date at the end. For example, if it's on 2021-12-31 it will add 2022-01-30 etc. And i would like add to J69 date.
Range("J64").Select
Selection.Copy
Range("J68").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
With Range("J69").CurrentRegion
CodePudding user response:
If I correctly understood what you need, please try the next adapted code:
Range("J68").value = Range("J64").value
Range("J64").Copy
Range("J68").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("J69").value = DateAdd("m", 1, Range("J68").value) - 1
It will paste the value from "J64" in "J68", then copy the "J64" format and place in "J69" a date calculated by adding a months -1 to the above cell.