I am attempting to edit my code because although it functions as needed, I know it is not efficient. I am copying 5 merged cells at a time and pasting copied data in the column to the left before clearing the copied range.
Every 6th cell is skipped because it does not apply to what needs to be moved. A snippet is below, I know there is a much more efficient way to do what I am doing here, but I am brand new and have basically no experience in declaring variables or utilizing loops, functions, etc.
Thanks in advance!
Option Explicit
Sub ShiftWeeks()
Dim answer As VbMsgBoxResult
answer = MsgBox("Are you sure you want to copy/paste this weeks data?", vbYesNo, "Press Button for Macro")
If answer = vbYes Then
Range("c3:c8").Copy
Range("b3:b8").PasteSpecial xlPasteValues
Range("c3:c8").ClearContents
Range("c10:c15").Copy
Range("b10:b15").PasteSpecial xlPasteValues
Range("c10:c15").ClearContents
Range("c17:c22").Copy
Range("b17:b22").PasteSpecial xlPasteValues
Range("c17:c22").ClearContents
Range("c24:c29").Copy
Range("b24:b29").PasteSpecial xlPasteValues
Range("c24:c29").ClearContents
End If
End Sub
I've copied the same 3 code blocks quite a few times and have just changed the range. The button I made works, but I know the code is junk and it's not that difficult, but I don't know how to clean it up.