adding data to a list

  • Thread starter Thread starter Sandy
  • Start date Start date
S

Sandy

I have 2 sheets. Sheet1 is for data entry. Sheet 2 (Say A4:Z4) collects all
the data. What I would like to do is copy Row 4 and insert it into the next
empty row starting at row 15. In other words if three records have already
been entered then the row for insertion would be Row 18. I visualise this
being done with a macro assigned to a "Save" button on Sheet1. Not sure how
to establish the next empty row. Any easy way to do this?
Sandy
 
Assume column A will have an entry if the row is in use

Sub ABC()
If IsEmpty(Range("A15")) Then
Set rng = Range("A15")
ElseIf IsEmpty(Range("A16")) Then
Set rng = Range("A16")
Else
Set rng = Range("A15").End(xlDown)(2)
End If
MsgBox rng.Address
End Sub


Now rng should be a reference to the first cell in the next empty row
starting with A15
 
Once again many thanks
Sandy

Tom Ogilvy said:
Assume column A will have an entry if the row is in use

Sub ABC()
If IsEmpty(Range("A15")) Then
Set rng = Range("A15")
ElseIf IsEmpty(Range("A16")) Then
Set rng = Range("A16")
Else
Set rng = Range("A15").End(xlDown)(2)
End If
MsgBox rng.Address
End Sub


Now rng should be a reference to the first cell in the next empty row
starting with A15
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top