• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to copy in a calendar based on cell color

Raquel

New Member
Hi! I hope you can help. I am trying to write a macro to copy/transfer info from specific cells from file A to file B.
File A: There is a Date column, and a Task row with multiple task. The table shows the date(s) for every task; each task has a color
File B: There is a Task column; dates are shown in a row. I would like to transfer the content in File A to File B
The attached file tries to show what I am trying to achieve ...
Any help or suggestion will be welcome to automate the transfer of this data to a new file.
Thanks!!! Raquel.
 

Attachments

  • Copy cells based on cell color.xlsx
    13.9 KB · Views: 7
Hola !​
You must paste this demonstration to the Hoja1 worksheet module of your attachment :​
Code:
Sub Demo1()
        Dim V, R&, C&
    With [A4].CurrentRegion
            V = Application.Transpose(.Value2)
        For R = 2 To .Rows.Count
        For C = 2 To .Columns.Count
            If .Cells(R, C).Interior.ColorIndex > 0 Then V(C, R) = "X"
        Next C, R
    End With
        Workbooks.Add
    With ActiveSheet.[A1].Resize(UBound(V), UBound(V, 2))
        .Rows(1).NumberFormat = [A5].NumberFormat
        .Value2 = V
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Hola Marc!
Thank you very much! The macro works perfect, however it does not completely match with what I have in mind. The macro transpose all columns and rows; what I am trying is to build an instruction to look for the the colored cell for each task and then to insert "X" in the new file for that task and date. The files I have come from many different user and their format is not exactly the same, if I transpose all columns and rows I have a lot of cleaning work, I am trying to build something less painful for me! ;P
I keep on trying! :)
 
It was all I could guess according to your initial attachment, my demonstration just as a starter,​
so for further help the better is to join some relevant workbooks …​
 
Back
Top