如何在Excel中返回行进蚂蚁的位置? [英] How do I return the location of the marching ants in Excel?

查看:70
本文介绍了如何在Excel中返回行进蚂蚁的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Application.CutCopyMode,但是只返回CutCopyMode的状态(False,xlCopy或xlCut).

如何使用VBA返回Excel中当前已复制范围的地址?我不需要当前 selected 范围(即Application.Selection.Address).我需要周围带有移动边界(行军蚁)的单元格范围的地址.

换句话说,如果您选择一个单元格范围,请按CTRL + C,然后将所选内容移至另一个单元格,我需要用户按CTRL + C时所选单元格的地址. >

谢谢!

解决方案

据我所知,vba无法做到这一点.但是,您可以编写自己的copy子代码,并将源存储在全局变量中.

类似这样的东西:

Option Explicit
Dim myClipboard As Range

Public Sub toClipboard(Optional source As Range = Nothing)
    If source Is Nothing Then Set source = Selection
    source.Copy
    Set myClipboard = source
End Sub

I know about Application.CutCopyMode, but that only returns the state of the CutCopyMode (False, xlCopy, or xlCut).

How do I return the address of the currently copied range in Excel using VBA? I don't need the currently selected range (which is Application.Selection.Address). I need the address of the range of cells with the moving border (marching ants) around it.

In other words, if you select a range of cells, hit CTRL+C, and then move the selection to another cell, I need the address of the cells that were selected when the user hit CTRL+C.

Thanks!

解决方案

As far as I know you can't do that with vba. You can however code your own copy sub and store the source in a global variable.

Something like this:

Option Explicit
Dim myClipboard As Range

Public Sub toClipboard(Optional source As Range = Nothing)
    If source Is Nothing Then Set source = Selection
    source.Copy
    Set myClipboard = source
End Sub

这篇关于如何在Excel中返回行进蚂蚁的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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