Vikki_61
12-08-2007, 09:04 PM
Hi VBA gurus
I know this is a big ask ? but I certainly do not have the skill :banghead: to do what is below, so I hope some VBA wizard out there can help. :help
On Event open workbook (wookbook A)
For worksheets 3 though to worksheet 9 and only columns D, E, F, G, H , I and J, and only rows 4 through to 35 auto update from a source workbook
Note 1: - as you will see in the attached demo test file ?Workbook A? the row range 4 to 35 varies on each worksheet as the number of towns columns varies on each worksheet. So on one worksheet it might be row 4 to row 12 requiring update whereas on another worksheet it could be row 4 to up to row 35.
Note2: ?the source workbook is a closed /non active workbook on another server in my network ?path is X/sourcefiles/weeklydate/countfile.xls. In the source workbook the source is sheet 1.
Only update when there is a match of string of the place location name which are ALL listed in column C of the source worksheet ?matched to that of string place location names in workbook A in their respective worksheets 3 through to worksheet 9. Then when there is a match ? copy the content of the cells that correspond to the place location names in the source workbook (countfile.xls) from the columns D, E, F, G, H, I, and J.
Note 3. The way in which the source countfile works is that each week it will be updated with values/figures starting with column D in week 1 and column E in week 2 and column F in the third week and so on?..In the first week only column D will have values/ figures and the other columns will be empty ? and second week only columns D and E will have values/figures ? to make the code easy it would be OK to copy across the other columns when they are empty ? thus leaving the other columns in workbookA also empty. So in week two when workbook A is opened and is updated from the source file with values/figures for workbook A?s columns D and E of worksheets 3 through to 9 the other columns F, G H, I and J on those worksheets would have only be empty cells or just not updated at all ?as the source file at that time would have had only two weeks of figures entered.
Also copy across the column headings in row 4 for columns D, E, F, G, H, I , and J as those headings may change as they are dates.
The final bit that is important is that as worksheet A is updated the formula in column K it will need to auto update as well as it is the initial figures in column D minus the figures in the most recent column updated ? so if column G is updated today the formula needs to be =D5 ? G5 and =D6-G6 and so on whereas when updated next week the formula would need to change to =D5 ? H5 and =C6-H6 and so on.
Hope this is not too hard to follow and feel free to ask me any questions. :think:
My thanks in advance:hi:
Vikki_61:cloud9:
I know this is a big ask ? but I certainly do not have the skill :banghead: to do what is below, so I hope some VBA wizard out there can help. :help
On Event open workbook (wookbook A)
For worksheets 3 though to worksheet 9 and only columns D, E, F, G, H , I and J, and only rows 4 through to 35 auto update from a source workbook
Note 1: - as you will see in the attached demo test file ?Workbook A? the row range 4 to 35 varies on each worksheet as the number of towns columns varies on each worksheet. So on one worksheet it might be row 4 to row 12 requiring update whereas on another worksheet it could be row 4 to up to row 35.
Note2: ?the source workbook is a closed /non active workbook on another server in my network ?path is X/sourcefiles/weeklydate/countfile.xls. In the source workbook the source is sheet 1.
Only update when there is a match of string of the place location name which are ALL listed in column C of the source worksheet ?matched to that of string place location names in workbook A in their respective worksheets 3 through to worksheet 9. Then when there is a match ? copy the content of the cells that correspond to the place location names in the source workbook (countfile.xls) from the columns D, E, F, G, H, I, and J.
Note 3. The way in which the source countfile works is that each week it will be updated with values/figures starting with column D in week 1 and column E in week 2 and column F in the third week and so on?..In the first week only column D will have values/ figures and the other columns will be empty ? and second week only columns D and E will have values/figures ? to make the code easy it would be OK to copy across the other columns when they are empty ? thus leaving the other columns in workbookA also empty. So in week two when workbook A is opened and is updated from the source file with values/figures for workbook A?s columns D and E of worksheets 3 through to 9 the other columns F, G H, I and J on those worksheets would have only be empty cells or just not updated at all ?as the source file at that time would have had only two weeks of figures entered.
Also copy across the column headings in row 4 for columns D, E, F, G, H, I , and J as those headings may change as they are dates.
The final bit that is important is that as worksheet A is updated the formula in column K it will need to auto update as well as it is the initial figures in column D minus the figures in the most recent column updated ? so if column G is updated today the formula needs to be =D5 ? G5 and =D6-G6 and so on whereas when updated next week the formula would need to change to =D5 ? H5 and =C6-H6 and so on.
Hope this is not too hard to follow and feel free to ask me any questions. :think:
My thanks in advance:hi:
Vikki_61:cloud9: