Hi guys,
Firstly, although I have just joined this forum, I have been visiting this forum as a passive user for a few years now.
I would just like to say thank you in advance for all of the problems this community has already solved for me simply by answering other's issues.
The dedication of some members is truly amazing, and the apathy of some posters is equally astounding.
I am trying to save dynamic ranges into a scripting dictionary to simply paste back onto a worksheet.
I already have 90% of my code working (which is quite involved, I'll try not to bog this down too much)
Scenario:
I have a spreadsheet that renders staff rosters over a user selected date and date range (from one week to say 6 weeks)
User's have their own row (say 140 staff) and the days are listed chronological as columns left to right.
Each 'day' is actually 24 columns so I can render their shifts in a 'Gantt' chart style across each day.
This shows midnight crossings, double shifts, rest periods etc.....
The saved ranges within the dictionary contain merged cells, values, borders, colours and cell comments.
Each staff member has a unique ID and has only one row. This all works nicely so far.
So I have several dictionaries that I reference to build and rebuild the sheet each time.
I say rebuild because I also have the option for the user to select a date (by selecting that 'day' onscreen - Workbook_SheetSelectionChange)
By doing so, I reorder a specific dictionary for that day, reorder the staff ID's and want to redraw the sheet showing the sorted shifts for the selected day.
Which shift starts first, who is on first shift and so on,
Rendering the initial sheet take a little bit of time (workbook actually loads external data, builds several dictionaries - so user can wait for this),
But redrawing the sorted results I think should be faster considering I already have all of the data stored in memory.
I can redraw the sheet from the sorted data no problem, but rendering it takes too long to redraw (in my opinion) and ruins the user experience.
My idea was
+ copy each staff member's entire row as a range (which already has all the shift information, colours, cell comments etc) into a dictionary - (already done) - uses staff ID as the key
+ reorder the shifts as required and save a new listing of staff ID's based on the required order - (already done)
+ use this reordered staff list to paste their saved ranges back onto the worksheet (staff ID reordering for the selected day will display the sorted shifts as required)
I am just having some trouble extracting the saved range back onto the sheet, it doesn't reproduce the initial range.
Now I should say, copying ranges from one worksheet to another or even from one workbook to another is no problem, the issue *seems* to be the dictionary.
I must be missing something...
This is my code to build the Staff Ranges...
And to 'redraw' them onto a worksheet... (sheet has been cleared, new listing of staff IDs with required order has been prepared)
Finally, the target sheet will always be the same size (in that usedrange.columns.count will be the same)
any ideas?
Thanks in advance..
Baldric
Bookmarks