Learning Excel
Board Regular
- Joined
- Jul 27, 2002
- Messages
- 99
Hi,
I have a datasheet with 5000 rows.
There is week number in column E, starting from 1 to 52 in different rows
What I want is to populate the week in this column to Column A and populate till the next week number is found.
This will allow me to do sorting etc.
Appreciate some guidance on this.
Before ( Date in Column B through D are not the same, for illustration only)
A B C D E
Blank X Y Z 1
Blank X Y Z
Blank X Y Z
Blank X Y Z 2
Blank X Y Z
Blank X Y Z 3
Blank X Y Z
What I want
A B C D E
1 X Y Z 1
1 X Y Z
1 X Y Z
2 X Y Z 2
2 X Y Z
3 X Y Z 3
3 X Y Z
Attempt to write a macro, but is not what I want.
Sub AddWeek()
FinalRow = Cells(5000, 5).End(xlUp).Row
For i = FinalRow To 7 Step -1
If Cells(i, 5).Value >= "1" Then
Cells(i, 5).Copy Destination:=Cells(i, 1)
End If
Next i
End Sub
Thank
Learning Excel
I have a datasheet with 5000 rows.
There is week number in column E, starting from 1 to 52 in different rows
What I want is to populate the week in this column to Column A and populate till the next week number is found.
This will allow me to do sorting etc.
Appreciate some guidance on this.
Before ( Date in Column B through D are not the same, for illustration only)
A B C D E
Blank X Y Z 1
Blank X Y Z
Blank X Y Z
Blank X Y Z 2
Blank X Y Z
Blank X Y Z 3
Blank X Y Z
What I want
A B C D E
1 X Y Z 1
1 X Y Z
1 X Y Z
2 X Y Z 2
2 X Y Z
3 X Y Z 3
3 X Y Z
Attempt to write a macro, but is not what I want.
Sub AddWeek()
FinalRow = Cells(5000, 5).End(xlUp).Row
For i = FinalRow To 7 Step -1
If Cells(i, 5).Value >= "1" Then
Cells(i, 5).Copy Destination:=Cells(i, 1)
End If
Next i
End Sub
Thank
Learning Excel