Schedule Manager - Posting The Results

TheRedCardinal

Board Regular
Joined
Jul 11, 2019
Messages
243
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi all,

I normally try to have a go at coding my problems but this one I am totally stumped by.

For background please see this thread which I solved myself:


However the next step is proving beyond me.

What I have at the end of the above thread is an array of variable size (1 dimension is 6, the other varies). I need the data from columns 1, 5 and 6.

In WS1 I have a list of possible working days probably in Column A. The values in columns 5 and 6 must match those values (they are numbers corresponding to dates)

So for example in line in my array might be:

Task 1; x; x; x; 19; 22

What I need to do is paste the text of "Task" 1 into column B next to the date that it matches, like this:

1580492919867.png


Then the next task might look like this:

Task 2; x; x; x; 19; 23

This then needs to go UNDERNEATH the current task linked to 19 on a new row, which would look like this: (23 goes into its own row obviously):

1580493040603.png


The macro would loop through all 60 odd tasks allocating them as so, and then once that has been done, would find all matching dates and merge them into one cell like this:

1580493105978.png


Finally it would then colour all alternate rows (based on date) different shades for easy viewing.

I'm going to have a go at coding it but I'm lacking that starting point as to how to proceed!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I really should learn to have a go before giving up.

This seems to work nicely, though I had to shift the row insertion from below to above. I can easily achieve the same result by changing my For Counter section to starting at the UBound and going in -1 steps.

VBA Code:
Dim PasteRow As Long

With WS1

    For Counter = 1 To UBound(JobsArray)
    
        PasteRow = Application.WorksheetFunction.Match(JobsArray(Counter, 5), .Range("A:A"), 0)
        
        If .Cells(PasteRow, 2) = "" Then
            .Cells(PasteRow, 2) = "Prepare " & JobsArray(Counter, 1)
        Else
            .Rows(.Cells(PasteRow, 2).Row).Insert shift:=xlDown
            .Cells(PasteRow, 2) = "Prepare " & JobsArray(Counter, 1)
            .Cells(PasteRow, 1) = JobsArray(Counter, 5)
        End If
        
        PasteRow = Application.WorksheetFunction.Match(JobsArray(Counter, 6), .Range("A:A"), 0)
        
        If .Cells(PasteRow, 2) = "" Then
            .Cells(PasteRow, 2) = "Submit " & JobsArray(Counter, 1)
            
        Else
            .Rows(.Cells(PasteRow, 2).Row).Insert shift:=xlDown
            .Cells(PasteRow, 2) = "Submit " & JobsArray(Counter, 1)
            .Cells(PasteRow, 1) = JobsArray(Counter, 6)
        End If
        
    Next Counter
    
End With

However the stage with merging the duplicate cells into one and centering the date, plus subsequent formatting is still outstanding.

Any tips?
 
Upvote 0

Forum statistics

Threads
1,215,743
Messages
6,126,605
Members
449,321
Latest member
syzer

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