I might have found an answer to my own problem previously posted but I cant get the code changed right.
This code takes data on a form and moves it to a different sheet in the workbook in the order I need it to. There are three more macros similar to this one that I use also but if I get it to work on this one I can make it work on the others I am pretty sure. The change I need i this code is....instead of moving the data into a different sheet within this workbook, I need it to populate the same cells on a sheet (named the same) only in a DIFFERENT workbook.
I"ve tried changing the =Worksheets("Timesheets") to the appropraite folder loc but it doesnt seem to work. Is there a simple fix here?
Sub UpdateLogWorksheet()
Dim historyWks As Worksheet
Dim inputWks As Worksheet
Dim nextRow As Long
Dim oCol As Long
Dim myRng As Range
Dim myCopy As String
Dim myCell As Range
myCopy = "H11,A61,A12,B61,B7,H9,B61,C61,D61,H12,E61,F61,G61,H13,H61,I61,J61,A49,A50,A51,A52,A53,A54,A55,A56,A57,A58,H49,H50,H51,H52,H53,H54,H55,H56,H57,H58"
Set inputWks = Worksheets("Timesheet")
Set historyWks = Worksheets("WorkCompCore")
With historyWks
nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
End With
With inputWks
Set myRng = .Range(myCopy)
End With
With historyWks
oCol = 1
For Each myCell In myRng.Cells
historyWks.Cells(nextRow, oCol).Value = myCell.Value
oCol = oCol + 1
Next myCell
End With
'clear input cells that contain constants
With inputWks
On Error Resume Next
On Error GoTo 0
End With
End Sub
Bookmarks