VNBA copying a counted number of lines until a cell value equals number of lines in data sheet

KarlH

New Member
Joined
May 13, 2020
Messages
5
Office Version
  1. 2019
Platform
  1. Windows
I have a simple workbook. three tabs -
TAB 1"Control" where the macro can be triggered,
TAB2 "Count" where all the contract ID's are dropped, in cell L1 the total number of lines of contracts are multiplied by all the months in a given time period. E.g for 2014-2020 by month there are 84 months, there are 408 contracts, so by adding 1 to this number, we get the number of rows including titles we require. In Cell o1 we have return back count of how many rows there are in the tab 3 "DATA" ( including the row titles) which is where i would like to copy the 408 contacts repeatedly , until I have the required number of lines to have a contract line for each month of the year for all 84 periods ( but of course I can vary the periods to be more or less in thde count tab before I trigger the macro) . Of course when 408 contacts becomes more, I can just use the formulae to count how many times to copy the contract list in the new version.

I have tried my best to get this to work, but I am quite the noob on macros. Any help would be most gratefully received ! the extra movements were to make sure the next copy was at the end of the existing range of copied data. Let me know if it is unclear what I am trying to do !

Code I have used so far is :

Sheets("COUNT").Select
Range("A380").Select
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DATA").Select
Range("A403").Select
Selection.End(xlUp).Select
Selection.End(xlDown).Select
Selection.End(xlUp).Select
Range("A2").Select
ActiveSheet.Paste
Selection.End(xlDown).Select
Do Until Sheets("COUNT").Select.Range("l1") = Range("o1")


End Sub
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,214,972
Messages
6,122,530
Members
449,088
Latest member
RandomExceller01

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