VBA: Copying 5 columns in a group and pasting it to the subsequent 5 columns of the same sheet..

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,012
Office Version
  1. 2019
Platform
  1. Windows
Hello, How are the ms excel experts?

I wanted to ask of you a favour. Like the title suggests, a Vba that could copy the values from columns F, G, H, I and J and paste these as values into
columms K, L, M, N and O respectively. These Columns from F to O are Hidden. I'd like the code to copy from Row 5 til last data cell in column F.
So the data in this range consists of formulas which outputs numerical whole numbers that needs to be copied as values to the subsequent columns.
Rather simple, I am sure, for the excel gurus.

Will appreciate a lot.
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
1,091
Office Version
  1. 2013
Platform
  1. Windows
Hi
Simply
Try
VBA Code:
Sub test()
    Dim a As Variant
    a = Cells(5, 6).Resize(Cells(Rows.Count, 6).End(xlUp).Row, 5).Value
    Cells(5, 6).Offset(, 5).Resize(UBound(a, 1), UBound(a, 2)) = a
End Sub
 
Solution

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,012
Office Version
  1. 2019
Platform
  1. Windows
Hi
Simply
Try
VBA Code:
Sub test()
    Dim a As Variant
    a = Cells(5, 6).Resize(Cells(Rows.Count, 6).End(xlUp).Row, 5).Value
    Cells(5, 6).Offset(, 5).Resize(UBound(a, 1), UBound(a, 2)) = a
End Sub
Thank you so much mohadin.
I really appreciate that.
 

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
1,091
Office Version
  1. 2013
Platform
  1. Windows
You are welcome
And thank you for the feedback
Be Happy
 

Watch MrExcel Video

Forum statistics

Threads
1,127,765
Messages
5,626,738
Members
416,201
Latest member
brianhf

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
Top