如何在Excel中粘贴B列的最后一行? [英] How to paste in last row of Column B in excel?

查看:93
本文介绍了如何在Excel中粘贴B列的最后一行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将单元格从H2:L2完全切下并粘贴到B列的最后一行.

I need to cut cells from H2:L2 to all the way down and paste it in last row of column B.

每次数据都会有所不同,所以我无法对任何范围进行硬编码.

Data will be different everytime so I cannot hard code any range.

将VBA代码从H2:L2剪切下来并粘贴/插入B列的最后一行会很好.

VBA code would be nice, to cut from H2:L2 down and paste/insert in the last row of Column B.

到目前为止,我知道了.

So far I got.

Range("H2:L2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Cut

推荐答案

这是一段代码,应该可以满足您的需求.

Here is a segment of code that should accomplish what you are looking for.

Start code including your cut segment...
Dim lastRow As String

lastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row + 1
Range("B" & lastRow).Select
Selection.PasteSpecial
Rest of code...

有很多书籍可以帮助您进行此类编码,并有逐步的培训.我属于Microsoft发行的"Step by Step"系列文章的一部分.祝你好运!

There are a number of books that will help with this type of coding and have step by step trainig. I am partial to the series published by Microsoft "Step by Step" series. Best of luck!

这篇关于如何在Excel中粘贴B列的最后一行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆