copying data to next available empty columns

themole

Board Regular
Joined
Oct 26, 2009
Messages
96
hi,

sorry if this has been covered before.

i have a table of names (75 in total) and values, every week the values will change on the table. What i am after is a code so that once i click on the control button it will automatically copy and paste the list of names and corresponding values into next available empty columns in spreadsheet.

original list of names range from A4:A78 and values B4:B78. ideally would like to start copying data into columns D:E, leave column F blank then once control button clicked again to start copying into columns G:H, leave column I blank, and so on

hope this sounds straight forward,

cheers
 
hi,

after a little minor tweek to the code please. the cells in columns A:E contain formulas. The code is copying the formulas across into other columns, what i would like is if it would just copy the cell values,

thanks
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Code:
Sub v()
Dim rng As Range
Set rng = Intersect([A:E], Range([A1], ActiveSheet.UsedRange))
Cells(1, rng.Columns.Count + 3).Resize(rng.Rows.Count, 5) = rng.Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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