简体   繁体   中英

VBA - Copy cell and paste into an empty cell on another sheet

I'm new to VBA so please bear with me. I was wondering if someone could help me please with an issue I am experiencing. Can someone help me copy the cell V10 in a sheet named "Standard_NewSale_GSS" and paste into the next available empty cell in the Column E in the "Standard_Basket" sheet. If anyone can help it would be very much appreciated! It's for my coursework at college.

If you wish to hardcode these values into your subroutine, you could do something like the following:

Option Explicit
Sub CopyIntoStandardBasketColumnE()
    Dim nextCellInColumn As Range
    Set nextCellInColumn = Worksheets("Standard_Basket").Cells(Rows.Count, 5).End(xlUp).Offset(1, 0)
    nextCellInColumn.Value = Worksheets("Standard_NewSale_GSS").Range("V10").Value
End Sub

This finds the last cell of column E in Worksheets("Standard_Basket") by starting at the last row of the worksheet and using End(xlUp) to find a cell with a value. Then it uses Offset to move to the next row. Finally it sets this cell's value to be equal to cell V10 of Worksheets("Standard_NewSales_GSS") .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM