Hi everyone.
I've searched and searched and can't seem to find what i'm looking for. I'm fairly novice at VBA so not sure where to start so i'll try and explain as best as I can:
In my Workbook I have several sheets. One sheet "Weekly Report" allows the user to select a period and week from drop down menu's in a userform (opened with a command button). Then when they click "OK", a macro then populates the Weekly Report sheet with various bits of information relevant to the period and week selected. Works a treat. What I want to be able to do, is to have another command button in the sheet to "Export" the data.
What I actually want this "export" to do is to add all the data that's just been retrieved and populated in the various cells of the Weekly Report, into a hidden sheet called "Data". But I need the data pasting into 1 row. Then when the report is ran again for a different week, it populates the row below, and so on. Except, it the data has already been populated for that Period and Week in the Data sheet, then it needs to override the data in that row with the new data. Assuming in order to do this it needs to match with a certain criteria that's not going to be duplicated, I've already set a cell in the Weekly Report sheet to populate with a "Unique ID" which consists of the location ID number (set in another sheet) & Period & Week numbers (using the RIGHT function to remove "P" and "Wk" as shown in the screen snip. e.g. if the location ID was 12345 and the report was ran for Period 6 Week 2, cell I5 would read "12345062".
I've attached a snip of what the Weekly Report looks like. As you can see, the cells (currently all "0") where the data is populated are all over the place.
The workbook is protected with password so all VBA in the workbook has to unlock the relevant sheets before locking them again when any changes are made.
Is it possible to do what I want? Or is it too complicated?
Thanks in advance.
I've searched and searched and can't seem to find what i'm looking for. I'm fairly novice at VBA so not sure where to start so i'll try and explain as best as I can:
In my Workbook I have several sheets. One sheet "Weekly Report" allows the user to select a period and week from drop down menu's in a userform (opened with a command button). Then when they click "OK", a macro then populates the Weekly Report sheet with various bits of information relevant to the period and week selected. Works a treat. What I want to be able to do, is to have another command button in the sheet to "Export" the data.
What I actually want this "export" to do is to add all the data that's just been retrieved and populated in the various cells of the Weekly Report, into a hidden sheet called "Data". But I need the data pasting into 1 row. Then when the report is ran again for a different week, it populates the row below, and so on. Except, it the data has already been populated for that Period and Week in the Data sheet, then it needs to override the data in that row with the new data. Assuming in order to do this it needs to match with a certain criteria that's not going to be duplicated, I've already set a cell in the Weekly Report sheet to populate with a "Unique ID" which consists of the location ID number (set in another sheet) & Period & Week numbers (using the RIGHT function to remove "P" and "Wk" as shown in the screen snip. e.g. if the location ID was 12345 and the report was ran for Period 6 Week 2, cell I5 would read "12345062".
I've attached a snip of what the Weekly Report looks like. As you can see, the cells (currently all "0") where the data is populated are all over the place.
The workbook is protected with password so all VBA in the workbook has to unlock the relevant sheets before locking them again when any changes are made.
Is it possible to do what I want? Or is it too complicated?
Thanks in advance.