I am trying to get selected data from a macro but it's taking too much time, I am naive to excel macros don't know how to trouble shoot it.
Macro is as follows
Code
Sub test()
Application.ScreenUpdating = False
Dim i As Integer, x As Integer
[AA3:AB400] = 0
For x = 3 To 397
For i = 2 To 4448
If Cells(i, 2) = Cells(x, 26).Value And Cells(i, 8) = "CO" _
Then Cells(x, 27).Value = Cells(x, 27).Value + Cells(i, 13).Value
If Cells(i, 2) = Cells(x, 26).Value And Cells(i, 8) = "DO" _
Then Cells(x, 28).Value = Cells(x, 28).Value + Cells(i, 13).Value
If Cells(i, 2) = Cells(x, 26).Value And Cells(i, 8) = "CS" _
Then Cells(x, 29).Value = Cells(x, 29).Value + Cells(i, 13).Value
If Cells(i, 2) = Cells(x, 26).Value And Cells(i, 8) = "DS" _
Then Cells(x, 30).Value = Cells(x, 30).Value + Cells(i, 13).Value
Next i
Next x
Application.ScreenUpdating = True
End Sub
Display More
Column reference are as follows:
2= Project code (All Number) in data
26= Output Project code for which data is required (Macro Output)
8 = Type of activity (CO, CS, DO, DS)
13= Number of hours
30=Hours (Macro Output)
Data sheet is as below
[ATTACH=CONFIG]68685[/ATTACH]