VBA help: Copy column and paste values into empty column to the right

DioExcel

New Member
Joined
Aug 9, 2017
Messages
2
Hello,
Is it possible to have macro copy one column and paste the value to the next empty column in the same sheet? Please note the existing "new draw" macro copies all values in the Total columns and paste values to Prior columns and clears contents of Current columns. This addition to the code would have to occur prior to the clearing of the current values. Below is existing code and were I assume the additional code should be inserted.

Thanks in advance for your suggestions.



Dim Res As VbMsgBoxResult
Res = MsgBox("CANNOT UNDO: Ready to clear current amounts and combine with prior totals?", vbYesNo)
If Res = vbYes Then
' comment on action user will take-- user clicks yes and macro proceeds, user clicks no it stops
Else
Exit Sub
End If


Sheet2.Unprotect

ASSUMING THIS IS WHERE THE ADDITIONAL CODE TO COPY/PASTE VALUES TO NEXT EMPTY COLUMN WOULD BE. I WOULD LIKE IT TO START PASTING IN COLUMN "AA" AND WORK ITS WAY TO THE RIGHT WITH EACH ENTRY



For Each c In Range("e11:e234")
If c.Interior.Color = RGB(255, 255, 185) Then
c.Offset(0, -1).Value = c.Offset(0, -1).Value + c.Value
c.ClearContents
End If
Next c

For Each c In Range("i11:i234")
If c.Interior.Color = RGB(255, 255, 185) Then
c.Offset(0, -1).Value = c.Offset(0, -1).Value + c.Value
c.ClearContents
End If
Next c


For Each c In Range("l11:l234")
If c.Interior.Color = RGB(255, 255, 185) Then
c.Offset(0, -1).Value = c.Offset(0, -1).Value + c.Value
c.ClearContents
End If
Next c


For Each c In Range("b6:b7")
c.ClearContents
Next c


Sheet2.Protect , AllowFormattingColumns:=True, AllowFormattingRows:=True
Application.ScreenUpdating = True
MsgBox "All Current amounts have been added to Prior amounts"


'Sheet2.Range("A1").Value = Sheet2.Range("A1").Value + Sheet2.Range("B1").Value
End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,215,889
Messages
6,127,593
Members
449,386
Latest member
owais87

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