Consulting

Results 1 to 13 of 13

Thread: clear last but one line to a userform

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Question clear last but one line to a userform

    Hi

    I have kindly been given a macro below that clears the last line and retains the formular to a userform list box.

    Sub clear()
        Dim x As Long
        
        With Sheets("database")
            x = .Cells(.Rows.Count, 1).End(xlUp).Row
            .Cells(x, 1).EntireRow.SpecialCells(xlConstants).ClearContents
        End With
    End Sub
    Is it possible to improve on the macro so that it never clears the very last row as this row contains the list box headings.

    I could get around it also if the macro refered just to a range rather than the entire sheet!!!


    Many thanks in advance

    Regards

    Keith
    Last edited by Aussiebear; 06-30-2022 at 03:33 AM. Reason: Added code tags to supplied code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •