greenparrot
New Member
- Joined
- Jan 30, 2004
- Messages
- 41
Morning
I have a macro, which sorts data, add values and creates dates and week no.s, all works fine apart from the date part, during the marco the date gets input into a cell as 04-Oct for example, i want it the other way around and it also does this but it when it changes the date formatting, it turns 04 to 05.
anyone have any ideas?
For x = 1 To rowscount
If ActiveCell.Offset(0, 8).Value >= 0 Then
ActiveCell.Offset(0, 6).Value = "UP"
End If
If ActiveCell.Offset(0, 8).Value < 0 Then
ActiveCell.Offset(0, 6).Value = "DOWN"
End If
If ActiveCell.Offset(0, 12).Value = "UW" Then
ActiveCell.Offset(0, 3).Value = "Waste"
End If
If ActiveCell.Offset(0, 12).Value = "UI" Or ActiveCell.Offset(0, 12).Value = "UA" Or ActiveCell.Offset(0, 12).Value = "PI" Or ActiveCell.Offset(0, 12).Value = "PH" Then
ActiveCell.Offset(0, 3).Value = "Adjustment"
End If
If ActiveCell.Offset(0, 12).Value = "UE" Then
ActiveCell.Offset(0, 3).Value = "Staff"
End If
If ActiveCell.Offset(0, 12).Value = "UC" Then
ActiveCell.Offset(0, 3).Value = "S/C"
End If
If ActiveCell.Offset(0, 9).Value <= 0 Then
ActiveCell.Offset(0, 20).Value = ActiveCell.Offset(0, 9).Value * -1
Else
ActiveCell.Offset(0, 20).Value = ActiveCell.Offset(0, 9).Value * 1
End If
startdate = #9/19/2004#
mydate = ActiveCell.Offset(0, 10).Value
weekno = DateDiff("ww", startdate, mydate)
thisweekno = DateDiff("ww", startdate, Date)
myformatmonth = Format(mydate, "mmm-yy")
myyear = DatePart("yyyy", mydate)
ActiveCell.Offset(0, 5).Value = weekno
ActiveCell.Offset(0, 4).Value = myformatmonth
ActiveCell.Offset(1, 0).Select
Next x
I have a macro, which sorts data, add values and creates dates and week no.s, all works fine apart from the date part, during the marco the date gets input into a cell as 04-Oct for example, i want it the other way around and it also does this but it when it changes the date formatting, it turns 04 to 05.
anyone have any ideas?
For x = 1 To rowscount
If ActiveCell.Offset(0, 8).Value >= 0 Then
ActiveCell.Offset(0, 6).Value = "UP"
End If
If ActiveCell.Offset(0, 8).Value < 0 Then
ActiveCell.Offset(0, 6).Value = "DOWN"
End If
If ActiveCell.Offset(0, 12).Value = "UW" Then
ActiveCell.Offset(0, 3).Value = "Waste"
End If
If ActiveCell.Offset(0, 12).Value = "UI" Or ActiveCell.Offset(0, 12).Value = "UA" Or ActiveCell.Offset(0, 12).Value = "PI" Or ActiveCell.Offset(0, 12).Value = "PH" Then
ActiveCell.Offset(0, 3).Value = "Adjustment"
End If
If ActiveCell.Offset(0, 12).Value = "UE" Then
ActiveCell.Offset(0, 3).Value = "Staff"
End If
If ActiveCell.Offset(0, 12).Value = "UC" Then
ActiveCell.Offset(0, 3).Value = "S/C"
End If
If ActiveCell.Offset(0, 9).Value <= 0 Then
ActiveCell.Offset(0, 20).Value = ActiveCell.Offset(0, 9).Value * -1
Else
ActiveCell.Offset(0, 20).Value = ActiveCell.Offset(0, 9).Value * 1
End If
startdate = #9/19/2004#
mydate = ActiveCell.Offset(0, 10).Value
weekno = DateDiff("ww", startdate, mydate)
thisweekno = DateDiff("ww", startdate, Date)
myformatmonth = Format(mydate, "mmm-yy")
myyear = DatePart("yyyy", mydate)
ActiveCell.Offset(0, 5).Value = weekno
ActiveCell.Offset(0, 4).Value = myformatmonth
ActiveCell.Offset(1, 0).Select
Next x