I have developed some VBA code that does what you ask, however, to make it work, you must unmerge all data cells in sheet1. VBA does not like to work with merged cells and if you do not unmerge your cells, this code will fail.
Option Explicit
Sub ams()
Dim sh1 As Worksheet, sh2 As Worksheet
Set sh1 = Sheet1
Set sh2 = Sheet2
Dim i As Long
i = Day(sh1.Range("D3"))
Application.ScreenUpdating = False
sh1.Range("F7:F13").Copy
sh2.Range("B" & i + 6).PasteSpecial xlPasteAll, , , True
Application.Union(sh1.Range("F19"), sh1.Range("H19"), sh1.Range("J19")).Copy sh2.Range("I" & i + 6)
Application.Union(sh1.Range("F20"), sh1.Range("H20"), sh1.Range("J20")).Copy sh2.Range("L" & i + 6)
Application.Union(sh1.Range("F21"), sh1.Range("H21"), sh1.Range("J21")).Copy sh2.Range("O" & i + 6)
sh1.Range("D24").Copy sh2.Range("R" & i + 6)
sh1.Range("I24").Copy sh2.Range("T" & i + 6)
Application.CutCopyMode = False
sh1.Range("F7:F13").ClearContents
sh1.Range("F19:J21").ClearContents
sh1.Range("I24").ClearContents
sh1.Range("D24").ClearContents
Application.ScreenUpdating = True
MsgBox "Action Completed"
End Sub
How to install your new code
- Copy the Excel VBA code
- Select the workbook in which you want to store the Excel VBA code
- Press Alt+F11 to open the Visual Basic Editor
- Choose Insert > Module
- Edit > Paste the macro into the module that appeared
- Close the VBEditor
- Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
To run the Excel VBA code:- Press Alt-F8 to open the macro list
- Select a macro in the list
- Click the Run button
Bookmarks