PDA

View Full Version : copy values to another worksheet in next down cell



ccruz
01-25-2013, 04:45 AM
Hello

every day I need copy the values from worksheet "input" of "material1" , "material2" and "material3" to worksheet name "Board" in next empty cell or correspondent day cell .
somebody could help me on that ?

thank you very much

ccruz

Kenneth Hobs
01-25-2013, 08:53 AM
Welcome to the forum!

In a Module:

Sub CopyToBoard()
Dim ws As Worksheet
For Each ws In Worksheets
With ws
If .Name = "board" Or .UsedRange.Cells.Count = 1 Then GoTo NextWS
.Range("2:" & .UsedRange.Rows.Count).Copy _
Worksheets("board").Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
NextWS:
Next ws
End Sub

ccruz
01-25-2013, 09:20 AM
thank you
it's copy but also add in column A the word INPUT
how to remove ?
is it possible run this macro only once per day ex. 05:00 even with the workbook closed ?

Kenneth Hobs
01-25-2013, 02:15 PM
I don't know your needs so I guessed that INPUT was a date like your master data. Of course all of the data copied to Column A in worksheet board could be removed but it is more efficient to just not copy it. One could reference the range less the first row and first column in each slave data sheet. I would have to work on that.

The best way to run it at a time each day would be to use Application.Run() in another workbook's Open Event and add that workbook to a Window's scheduled event task. That code would Open the workbook, run that macro, and then close it and the scheduled workbook.