Forum Discussion

G_Mason's avatar
G_Mason
Copper Contributor
May 08, 2020

Running a macros

I have created my own form and want to enter the data on the next line in my spreadsheet.

 

How do I get the macros to select the last line plus 1 further down. I have tried with formulas but it now includes those when going to the end.

 

Any help would be very much appreciated

 

Thanks Graham

2 Replies

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor

    G_Mason Assuming you are on a worksheet called Data:

    Dim firstEmptyCell As Range
    With Worksheets("Data")
        Set firstEmptyCell = .Range("A" & .Rows.Count).End(xlUp).Offset(1,0)
    End With
    'Now you can use firstEmptyCell:
    firstEmptyCell.Value = "New entry"
    • G_Mason's avatar
      G_Mason
      Copper Contributor
      Thanks ever so much Jan, I will give that a go. Not entirely sure how to entertain that into the macro but really appreciate your help.

      Cheers Graham