如果行的日期匹配,我正在尝试将行从一张复制到另一张。我以前使用过这种方法,并且效果很好。我无法确定自己一生中哪里出了问题。
ViewModelProviders.of(activity)
我也尝试过使用for-loop复制日期,
Public Sub dayreport()
Dim enteredday As Variant
Dim clockinday As Variant
Dim y As Integer
Dim yreport As Integer
Dim yrow As Integer
Dim daystring As String
Dim datecheck As Boolean
'Collect the entered date
enteredday = CVar(Sheets("Process").Cells(3, 3)) 'get the datestring out of the date cell
'Only progress if a date is entered
If IsDate(enteredday) = True Then
datecheck = True 'a usable date has been entered
Else
datecheck = False
MsgBox "Entered date must be a real date of the format dd/mm/yyyy"
End If
If datecheck = True Then
'Delete the day report if it already exists
Call Delete_Sheet("Day Report")
'create a new sheet
Worksheets.Add.name = "Day Report"
y = 7
yreport = 7
yrow = 7
'While there is data in any of the cells of the investigated row, loop
Do While Sheets("Process").Cells(y, 1) <> "" _
Or Sheets("Process").Cells(y, 2) <> "" _
Or Sheets("Process").Cells(y, 3) <> "" _
Or Sheets("Process").Cells(y, 4) <> "" _
Or Sheets("Process").Cells(y, 5) <> "" _
Or Sheets("Process").Cells(y, 6) <> "" _
Or Sheets("Process").Cells(y, 7) <> "" _
Or Sheets("Process").Cells(y, 8) <> "" _
'breakdown entered date
year = CInt(Right(enteredday, 4)) 'take the year component from the date and convert it to an integer
month = CInt(Mid(enteredday, 4, 2)) 'take the month component from the date and convert it to an integer
day = CInt(Left(enteredday, 2)) 'take the day component from the date and convert it to an integer
enteredday = DateSerial(year, month, day)
'Breakdown investigated date
clockinday = CVar(Sheets("Process").Cells(y, 2)) 'get the datestring out of the date cell
sheetyear = CInt(Right(clockinday, 4))
sheetmonth = CInt(Mid(clockinday, 4, 2))
sheetday = CInt(Left(clockinday, 2))
clockinday = DateSerial(sheetyear, sheetmonth, sheetday)
'copy the row pairs into the day report sheet if the entered date matches the date in the row
If enteredday = clockinday Then
For i = 1 To 9
Sheets(“Day Report”).Cells(yreport, i) = Sheets(“Process”).Cells(y, i)
Sheets(“Day Report”).Cells(yreport + 1, i) = Sheets(“Process”).Cells(y + 1, i)
yreport = yreport + 2
Next i
End If
yrow = yrow + 2
y = y + 2
Loop
End If
End Sub
好像看不到我的“流程表”,但是它被另一个运行良好的子程序填充