Excel/VBA最后一行/列 [英] Excel / VBA last row/column

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

问题描述

我需要复制粘贴大张纸,这需要很多时间.建议我不要在工作表上使用.copy过程,而应逐个单元进行.给新单元格提供古代单元格的每个属性.这就是我在这里所做的:仅保存一些另一个工作簿中的工作表.

I need to copy paste big sheets, this is taking a lots of time. I have been advised not to use .copy process on worksheets but rather proceeds cell by cell. Giving new cells each properties of the ancient cell. This is what I do here: Saving only some sheets in another Workbook.

要逐个单元地执行此操作,我需要知道最后一个包含信息的单元.(不仅值,还包括颜色,边框等).我在互联网上看到了许多简单的解决方案,但是它们都有问题.

To do it cells by cells I need to know the last cell containing information. (not only value, but colour, borders... etc). I've seen many simple solution on internet, but they all have a problem.

ActiveSheet.UsedRange.Rows.Count经常给出太多值...对于5 ​​ 18表,我得到了810 * 16000的答案

ActiveSheet.UsedRange.Rows.Count often gives too many values... I got a 810 * 16000 answer for a 5 * 18 table

range("A"& activesheet.rows.count).end(xlup).row仅适用于第一列...

range("A" & activesheet.rows.count).end(xlup).row works only for the first columns...

用值结束真正的最后一行的最佳方法是什么?包含信息(值,颜色,边框...)

What would be the best way to procedd to final the real last line with value ? containig information (value, colour, border...)

推荐答案

Excel 2010中的此命令 ActiveCell.SpecialCells(xlLastCell).Select 会将光标(活动单元格)移动到最后一个即使单元格当前为空,其值也很重要

This command in Excel 2010 ActiveCell.SpecialCells(xlLastCell).Select will move the cursor (active cell) to the last one that had a non-trivial value, even if the cell currently is blank

此命令 Range(Selection,ActiveCell.SpecialCells(xlLastCell)).Select 将选择从当前到最后一个具有非平凡值的所有单元格.

This command Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select will select all cells from the current to the last one that had a non-trivial value.

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

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