I have a table of data which has been imported to a sheet and need to delete some random contents, then copy a title down until the next title. For example, as attached. Column A will have a formula of B&" "&C and has to be this way due to vlookups in another table. The headers (bold e.g. 'London', 'Leeds', 'Manchester') have random sub contents (not in bold) that needs to be deleted, and then the header needs to be copied down underneath until the next header. Problem is that these headers are not fixed in a row and can move up and down dependant on the data in the download. They will always be in column B, and the 'field' will always be in column C. Thanks
Posts by freddie0
-
-
Re: Loop thru folder of workbook using cell value and copy/paste values beween files
as requested, attached files. Template1 data to feed into relative Files and tabs as per date, then save and close files
Thanks -
Re: Loop thru folder of workbook using cell value and copy/paste values beween files
Ahhh, had another look at this and worked out what was stopping it.
Thinks it's down to my explanation. It runs ok, but is the opposite way round to what I'm looking for. What is attached takes data from each of the location files (one for London, one for Leeds, etc....) and populates into the template. What I need is for the data that is in the template cells to populate into the relative Files (London, Leeds etc) bearing in mind that each files has a 'Smith' tab, a'Jones' tab etc.......
One of the guys I work with says 'hats off' to you for the in-depth coding - which he will be grabbing a copy of!
Hopefully I have managed to explain a bit more clearly, look forward to what comes next
Thanks -
Re: Loop thru folder of workbook using cell value and copy/paste values beween files
Getting to look into this today, but getting a debug in the 'Main' at the folowing line
If ThisWorkbook.Names(arr_Heading(0)).RefersToRange.Offset(lp - 1, 0) = "" Then 'first data column is empty so collect starting here
Thanks -
Re: Loop thru folder of workbook using cell value and copy/paste values beween files
It is hoped that they would be in the same columns, but in order to 'future proof' the files this may not be possible.
The headings will be the same though - if that's any help. Not forgetting that the destination will move down each day due to changing date.
Had it have been just one folder to enter the date then I could have worked out some sort of Vlookup, but there are many folders with these tabs. Also, putting lookups in the cells would make the folder huge given the amount of data required.
That is unless there is a script that could be used to open the folder, look for the next detination cells, enter a vlookup, save as values, then close?
A I said, new to this
Thanks -
Re: Loop thru folder of workbook using cell value and copy/paste values beween files
forum.ozgrid.com/index.php?attachment/38462/
try this as a sample -
Re: Loop thru folder of workbook using cell value and copy/paste values beween files
sorry, should have said - the 'template' xls is where the data will start, and the 'London' xls is a sample of where it will need to populate relevant to date and heading title
Thanks -
Re: Loop thru folder of workbook using cell value and copy/paste values beween files
the data in the template draws from a different tab where a report will be dumped. There are different sorts and formulae to pull the data into the version that is shown. You can put random figures in here for now, all cells will be populated with figures, and it si these figures that need to go into the other workbooks/tabs/folders, repeated on a daily basis.
I have highlighted the main columns needed, but as I said, they may not be fixed in the folders to be saved in -
Re: Loop thru folder of workbook using cell value and copy/paste values beween files
forum.ozgrid.com/index.php?attachment/38434/forum.ozgrid.com/index.php?attachment/38433/
Right, I have put some anonymous data in to try and give some indication of the problem. A report will bew placed into the 'data' tab of the template which will the pull the relevant figures into the 'template' field by look-ups or formula etc. In here you will see highlighted row headers that are needing to be copied accordingly. The scrgipt will have to look up 'London', open the London file (sample attached), check the template for the 'sub', e.g. Jones, choose the 'Jones' tab in the London file. Then match the date, and populate the figures relevant to the highlighted row headers which will be named. The position of the rows is not static so it will not be possible to count in 'x' number and place the data, it will have to look up the 'text' in that box. Then it will move to the next sub, open the relevant tab, and repeat the data copy, etc. It will then save and close the file (London), and look for the next file (e.g. Leeds), and repeat until finished.
As I said, if I can get one folder and sub then it will be repetition from there.
Thanks -
Please bear with me as I am very new to VB and currently stumbling my way through.
I have a set of data on a sheet with a date in column A (static), various locations in colum B, various repeated sub-headings in C (repeated for each location), and then some column headers where the data is populated in the relevant matching cells below (in line with each location and sub-heading).
What I need is a script to open a workbook for location 1, find the tab relevant to the sub-heading, once open find the date in the relevant row, match the column headings in the first sheet with the second, and enter the data accordingly. Obviously if someone could help on the first line I can replicate per sub-heading, workbook etc. Each workbook populated needs to save and close, then move to open the next location workbook and repeat.
The data in the first sheet is a collation from a report that will be run daily to then populate all files/sheets when ran.
Thanks