• 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 Recording

Hi Team,

I am unable to record a macro for the data given in the excel. I updated two tabs one is the actual data and the other one is the output.

Can someone please help me with how to record and run Macros for this. I had to manual cut paste column data to rows

Regards
Rajashekar
 

Attachments

  • Sample data.xlsx
    111.5 KB · Views: 6
Hi
Yes from actual data I cut paste it row by row as per dates and that's what is shown in output sheet. now I want to have the macro created for actual data and the output should be a macro click and I should the result like the data in output sheet
 
Rajashekar Reddy
How ... Your Actual Data don't have any formulas, but someway Expected output has ... cut paste it row by row ... hmm?
What ... the result like the data in output sheet ... like?
I could guess something, but You should able to explain what?
... and now You've Expected output.
 
Hi,​
as it at kid level to search on web so obviously just follow​
 
Right-click the green table at cell I2 on the Expected output sheet and choose Refresh.
It should be sorted correctly but I'm not sure if the dates will come out right if you're not in a locale with DD/MM/YY.
 

Attachments

  • Chandoo47038Sample data.xlsx
    160.8 KB · Views: 2
Macro version:
Code:
Sub blah()
Set destn = Sheets("Expected output").Range("H3")    'change this to A3 (currently H3 for comparison with your expected output).
With Sheets("Actual Data")
  For Each colm In .Range("E3:N173").Columns ' you may need to change this.
    For Each cll In colm.Cells
      destn.Resize(, 4).Value = .Cells(cll.Row, 1).Resize(, 4).Value
      destn.Offset(, 4).Value = .Cells(2, cll.Column).Value
      With destn.Offset(, 5)
        .Value = cll.Value
        .NumberFormat = "h:mm AM/PM"
      End With
      Set destn = destn.Offset(1)
    Next cll
  Next colm
End With
End Sub
 
Back
Top