简体   繁体   English

VBA-复制单元格并粘贴到另一张纸上的空白单元格中

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

I'm new to VBA so please bear with me. 我是VBA的新手,请多多包涵。 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. 有人可以帮我在名为“ Standard_NewSale_GSS”的工作表中复制单元格V10,然后粘贴到“ Standard_Basket”工作表的E列中的下一个可用空单元格中。 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. 这将从工作表的最后一行开始,并使用End(xlUp)查找具有值的单元格,从而找到Worksheets("Standard_Basket") E列的最后一个单元格。 Then it uses Offset to move to the next row. 然后,它使用“ Offset移动到下一行。 Finally it sets this cell's value to be equal to cell V10 of Worksheets("Standard_NewSales_GSS") . 最后,它将此单元格的值设置为等于Worksheets("Standard_NewSales_GSS")单元格V10

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用VBA并使用“偏移”将一系列单元格值复制并粘贴到另一张工作表中 - Copy and paste a range of cell values into another sheet with VBA and using Offset Excel VBA将特定的单元格复制并粘贴到另一个工作表 - Excel VBA copy and paste a specific cell to another Sheet 在每个工作表匹配的单元格上复制一个单元格并将其粘贴到另一个VBA - Copy a cell on one sheet and paste it on another VBA based on cell from each sheet matching 通过单元格引用在另一张表中循环输入值,然后复制公式值并使用 vba 将其粘贴到另一张表中 - Loop input values in another sheet through cell reference then Copy formula value and paste it to another sheet using vba MAC VBA 试图从每个工作表中剪切一个单元格并粘贴到下一个空单元格中的另一张表中 - MAC VBA Trying to cut one cell from each worksheet and paste in another sheet in next empty cell Excel VBA 从一个工作表中复制范围并将其一次一个单元格地粘贴到另一张工作表中 - Excel VBA copy range from one sheet and paste it one cell at a time in another sheet VBA复制并粘贴一个单元格与另一个单元格 - vba copy and paste one cell vs another 尝试从一张纸上复制一个范围并将其粘贴到另一张纸上一列中的下一个空单元格 - Trying to copy a range from one sheet and paste it to the next empty cell in a column on another sheet Excel VBA,如果单元格不是数字且列中为空,则选定单元格复制并粘贴到另一列 - Excel VBA, If cell is not numeric and empty in a column, selected cell copy and paste to another column 复制单元格背景颜色并将其粘贴到另一张工作表的相应单元格 - Copy cell background color and paste it to corresponding cell of another sheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM