Automatic Entry 'Copy and paste' based of cell value

FletchFletcher

New Member
Joined
May 21, 2013
Messages
2
(Spreadsheet can be downloaded at the bottom of this post, with all notes included).

Hello peoples!

I've always enjoyed trying to crack formulas myself and used this forum many times to help me, thank you. This one's got me stumped and I would really appreciate a nod in the right direction.

MrExcel002.png


I would like the 'VALUES' row (G7:R7) to be automatically populated from the 'DATA' row (G3:R3).

I would like to be able to change the numerical value under "NUMBER OF MONTHS TO REPEAT" (D7) so that the 'automatic copy and pasting' restarts 'copying and pasting' from the start of data into the next cell.

MrExcel003.png


In the Examples above, I've provided colour coded 'VALUES' to simulate what this would look like based of the 'NUMBER OF MONTHS TO REPEAT' value on the left.

In Example 1, the value for 'NUMBER OF MONTHS TO REPEAT' is 6, you will see there are 6 red 'copy and pasted' values ranging from 100-600, it then starts again with a set of green values 100-600.

I've supplied these notes in the spreadsheet you can download from this dropbox link:
https://dl.dropboxusercontent.com/u/14447602/Pics/Fletch-automatic-copy-paste-based-of-value-V2.xlsx

Thank you for your time on this.

Fletch
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
You may consider using a Function, I have taken the liberty of writing such function, here it is:
Code:
Function myfunct(start_month As Integer, num_of_month_to_repeat As Integer, this_month As Integer, values As Range) As Double
    Dim mtr As Integer
    If start_month > this_month Then
        myfunct = 0
    Else
        this_month = this_month - start_month + 1
        mtr = this_month Mod num_of_month_to_repeat
        If mtr = 0 Then
            mtr = num_of_month_to_repeat
        End If
        myfunct = values.Cells(1, mtr).Value
    End If
End Function
You can test the function in your modified workbook here
https://dl.dropboxusercontent.com/u/23094164/Fletch-automatic-copy-paste-based-of-value-V3.xlsm
Cheers
Sergio
 
Upvote 0
You can change the name of the function, myfunct is pretty silly, just tell me what you want the function to be named and I'll change it
 
Upvote 0
Sergio, I can't thank you enough for this formula, there is no way I could have written that.
I've never written a function, but because I've spent so long on this problem I'm actually able to understand how you created this.

You just taught a man to catch a fish :) Have a great week my friend. Fletch
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,941
Members
449,094
Latest member
teemeren

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