In the range of ("D10:T41") I am looking for the last used row + 1 and put data into it from another sheet
However, I am filling all rows from lr to the end of the range T41.
I believe my issue is on this line but can't figure it out. .Range("D41:T" & lr).Value = Sheets("Admin").Range("DailyAccumData").Value
I have tried .Range("D" & lr).Value = Sheets("Admin").Range("DailyAccumData").Value
however, that puts the data in one cell, not the range of cells.
Some assistance please.
Full code:
However, I am filling all rows from lr to the end of the range T41.
I believe my issue is on this line but can't figure it out. .Range("D41:T" & lr).Value = Sheets("Admin").Range("DailyAccumData").Value
I have tried .Range("D" & lr).Value = Sheets("Admin").Range("DailyAccumData").Value
however, that puts the data in one cell, not the range of cells.
Some assistance please.
Full code:
VBA Code:
Sub MoveAccums()
Dim lr As Long
Dim iReply As String
Dim Sht As Worksheet
Dim intDaysInMonth As Integer
Dim i As Integer
Dim Mess As Object, Recip
Application.ScreenUpdating = False
With Sheets("Accumulative")
If .Range("D41").Value = Empty Then
lr = Sheets("Accumulative").Range("D41").End(xlUp).Row + 1
'Debug.Print lr
.Range("D41:T" & lr).Value = Sheets("Admin").Range("DailyAccumData").Value
Else:
iReply = MsgBox(Prompt:="Daily Accumulative data is full" & vbNewLine & _
"Do you want to clear the data for a new month?." & vbNewLine & vbNewLine & "Click YES to continue or NO to cancel", _
Buttons:=vbYesNo, Title:="Daily Accumulative Data")
If iReply = vbNo Then
Exit Sub
Else:
If Not .Range("D60").Value = Empty Then
iReply = MsgBox(Prompt:="Monthly Accumulative data is full" & vbNewLine & _
"This data must be cleared to continue!." & vbNewLine & vbNewLine & "Click OK to continue.", _
Buttons:=vbOKOnly, Title:="Monthly Accumulative Data")
.Range("D49:T60").ClearContents
.Unprotect Password:="Accumulative"
lr = Sheets("Accumulative").Range("D60").End(xlUp).Row + 1
Sheets("Accumulative").Range("D49:T" & lr).Value = Sheets("Accumulative").Range("D42:T42").Value
.Range("AccumMonthlyTotals").Calculate
.Range("C10:T41").ClearContents
intDaysInMonth = Day(DateSerial(Year(Now()), Month(Now()) + 1, 0)) + 1 '+ TimeValue("07:00:00")
.Cells(10, 3).Resize(intDaysInMonth, 1).ClearContents
For i = 1 To intDaysInMonth
.Cells(10, 3).Offset(i - 1, 0) = DateSerial(Year(Now()), Month(Now()), i) + TimeValue("07:00:00")
Next i
lr = Sheets("Accumulative").Range("D41").End(xlUp).Row + 1
Sheets("Accumulative").Range("D10:T" & lr).Value = Sheets("Admin").Range("Q4:AG4").Value
Range("AccumMonthlyTotals").Calculate
Range("AccumTotals").Calculate
End If
End If
End If
End With
Application.ScreenUpdating = True
End Sub