Silly I know

  • Thread starter Thread starter Terry Klein
  • Start date Start date
T

Terry Klein

Rather than have 500+ rows that are identical. I thought that a little
VBA script might, as I input data into the next to last row,
automatically copy the last row and add it to the next empty cell/row.

That way it would always be one step ahead of me. This would keep the
workbook to a size that is only as big as it needs to be.

Is this possible?
 
I am developing a payroll sheet at work. It uses some vlookups for the
employee database as well as the hourly amounts. Each row represents one
employee for that day. The columns include SS#, base rate, O.T, D.T.,etc
and a bunch of others. It also does the calculations and sums at he the
end of each row for that employee.

To make a file that is good for an average week, I may need up to 500
repetitions of this single row. This however makes the file rather large
and some weeks I may not come close to needing that many rows.

To that end I was trying to think of a way that it would auto-copy/paste
additional rows as I near the end.

That way I could have, say 10 rows in the file to begin with and let it
expand according to the needs of that week.
 
Here is one way

Sub newline()
If [e4] <> 0 Then [e4] = 0
Cells([checksA].Rows.Count + 7, 1).Select
With ActiveCell
..Offset(0) = .Offset(-1)
..Offset(0, 4) = 1
End With
End Sub

Here's another

Sub newline()
r = Range("b65536").End(xlUp).Row
Range("a" & r & ":h" & r).AutoFill Destination:=Range("a" & r & ":h" & r +
1), Type:=xlFillFormats
Range("e" & r).Copy Range("e" & r + 1)
Range("e" & r + 1) = ""
Range("b" & r + 1) = Date
Range("b" & r + 1).Select
End Sub
 
BTW.
"Silly I know" is not a good subject line.
Many won't even bother to look

"New line question" would have been better.
 
Back
Top