我的日期范围从b1,c1,d1,e1 .....等等我尝试制作一个循环来检查日期并复制当前月份的整列但它不起作用..任何人都可以帮助?
MESSAGE('%1', NoOfDays);
dur := NoOfDays * 24 * 3600 * 1000;
MESSAGE('%1', dur);
答案 0 :(得分:0)
你的代码没有拿起你想要推荐的单元格。
Sub dat()
Dim Lastcolumn As Long
Dim Curcolumn As Long
Dim NextDest As Long
Dim ws As Worksheet
Set ws = Sheets("SHEET1")
For Curcolumn = 2 To 10
If IsDate(ws.Cells(1, Curcolumn).Value) = True Then
If Month(ws.Cells(1, Curcolumn).Value) = Month(Date) Then
ws.Range(Cells(1, Curcolumn), Cells(CurRow, 4)).Copy
NextDest = Sheets("SHEET2").Range("1s" & Column.Count).End(xlUp).Row + 1
Sheets("SHEET2").Range(Cells(1, NextDest), Cells(NextDest, 4)).PasteSpecial
Else
End If
Else
ws.Cells(1, Curcolumn).Interior.Color = RGB(255, 0, 0)
End If
Next Curcolumn
End Sub