Search code examples
excelvbacopy-paste

Copy and Paste in next empty row beginning with B59


I used this line in VBA before to paste data on the first empty row in a worksheet

Sheets("Sheet1").Range("B" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlValues

Is it possible to modify it, so it pastes the data on the first empty row beginning with B59?


Solution

  • That line of code is looking for the last row with content in column B and pasting below that.

    If Column B has no text you could add any content on cell B58 and your line of code will start pasting into B59,

    If column B already has text below B59 and you want to overwrite it you should add a loop or For do something like this:

        For x = 59 To 100
            Sheets("Sheet1").Range("B" & x).PasteSpecial Paste:=xlValues
        Next