Hello,
I am trying to take a daily total, lets say from B1, and add it into a seperate workbook Column "B", daily. However, I would like to add the date to display in column A, in addition to adding the total for that day into column "B" when the script is ran. Im pretty sure I can just use =today() if that will be simplest (unless of course theres an easier way to stick the date into the cell via VBA). Im not sure about the syntax, but Im thinking where I have (nextrow, "B"), I can add the date via (nextrow, "A"). I tried to formular1c1, but not sure if theres a more practical way? I think im over-thinking it..
Also, the workbook to copy from will be named different every day, so I have set it to Workbooks(2). Thanks for any suggestions!
Sub EXPORT()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = Workbooks.Open(Filename:= _
"DailyCountNumber.xls")
Set ws = wb.Worksheets(1)
With ws
nextrow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With
With Workbooks(2).ActiveSheet
.Range("B1").Copy ws.Cells(nextrow, "B")
End With
wb.Save
wb.Close
Set ws = Nothing
Set wb = Nothing
End Sub
:EDIT:
My solution is to add:
With Workbooks(2).ActiveSheet
ws.Cells(nextrow, "A") = Date
.Range("B1").Copy ws.Cells(nextrow, "B")
How do I set the date to format as 17-Aug for example without having to format the column every time?
Bookmarks