Hi all, as a newbie, I got a copy-paste problem using VBA. And here is the snapshot of my minimum working environment.
At the end of each month, we will get data for column C and we were supposed to paste Column C data to the green area in order to get the total number.
By using a little bit of Google, what we currently have is:
Notice this is the code for Month 3(M3) button since cell A3 is telling us the date. And we put 12 similar buttons under 12 columns -_-+
That’s quite dumb, isn’t it? What makes things worse is if we clicked the wrong button, the total number will be messed up.
So I am wondering if there is a way to set up one button instead of 12, and copy & paste data from column C to corresponding green columns based on Month(A3)?
Thank you in advance.
At the end of each month, we will get data for column C and we were supposed to paste Column C data to the green area in order to get the total number.
By using a little bit of Google, what we currently have is:
VBA Code:
Sub MonthlyPaste()
On Error Resume Next
Dim xRg As Range
Set xRg = Application.Selection
Range("C6:C30").Copy Range("G6:G30")
xRg.Select
End Sub
Notice this is the code for Month 3(M3) button since cell A3 is telling us the date. And we put 12 similar buttons under 12 columns -_-+
That’s quite dumb, isn’t it? What makes things worse is if we clicked the wrong button, the total number will be messed up.
So I am wondering if there is a way to set up one button instead of 12, and copy & paste data from column C to corresponding green columns based on Month(A3)?
Thank you in advance.