今天11/17写了100,明天再写数据不改么?
- Sub kdy()
- arr = Sheet2.Range("a1:o" & Sheet2.Cells(Rows.Count, 1).End(xlUp).Row)
- brr = Sheet1.Range("a1:k" & Sheet1.Cells(Rows.Count, 1).End(xlUp).Row)
- Debug.Print arr(2, 1)
- Debug.Print brr(5, 4)
- Debug.Print brr(5, 11)
- If Day(Now) <= 15 Then
- For i = 1 To UBound(arr, 2)
- If Format(Month(Now) - 1, "00月") = arr(1, i) Then
- For j = 1 To UBound(arr)
- For k = 2 To UBound(brr)
- If arr(j, 1) = brr(k, 4) And brr(k, 11) <> "" And arr(j, i) = "" Then
- arr(j, i) = brr(k, 11)
- ElseIf arr(j, 1) = brr(k, 4) And brr(k, 11) = "" And arr(j, i) = "" Then
- arr(j, i) = brr(k, 8) - brr(k, 9)
- End If
- Next
- Next
- End If
- Next
- Else
- For i = 1 To UBound(arr, 2)
- If Format(Month(Now), "00月") = arr(1, i) Then
- For j = 1 To UBound(arr)
- For k = 2 To UBound(brr)
- If arr(j, 1) = brr(k, 4) And brr(k, 11) <> "" And arr(j, i) = "" Then
- arr(j, i) = brr(k, 11)
- ElseIf arr(j, 1) = brr(k, 4) And brr(k, 11) = "" And arr(j, i) = "" Then
- arr(j, i) = brr(k, 8) - brr(k, 9)
- End If
- Next
- Next
- End If
- Next
- End If
- Sheet2.Range("a1:o" & Sheet2.Cells(Rows.Count, 1).End(xlUp).Row) = arr
- End Sub
复制代码 |