Tom
Tom

Reputation: 1

VBA- add data to next empty row

I've written the below macro to transfer data from one worksheet to another. I want the new data being transferred to an empty row, but it keeps overwriting the same to rows

  Worksheets("sheet1").Select
     Worksheets("sheet1").Range("a1").Select
     RowCount = Worksheets("sheet1").Range("A1").CurrentRegion.Rows.Count
     With Worksheets("Sheet1").Range("A1")
     .Offset(RowCount, 0) = workOrderDescription

Upvotes: 0

Views: 10568

Answers (1)

Shai Rado
Shai Rado

Reputation: 33672

Try the code below:

With Workbooks("Your_WorkbookmName").Worksheets("sheet1")
    RowCount = .Cells(.Rows.Count, "A").End(xlUp).Row ' <-- get last row in column "A"
    .Range("A" & RowCount + 1) = workOrderDescription
End With

Upvotes: 3

Related Questions