对Excel进行编程时将选择设置为“无" [英] Setting selection to Nothing when programming Excel

查看:108
本文介绍了对Excel进行编程时将选择设置为“无"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在使用range.copy和range.paste之后创建图形时,它使粘贴范围保持选中状态,然后当我在几行之后创建图形时,它将所选内容用作图形中的第一个序列.我可以删除该系列,但是有没有更优雅的方法呢?我尝试过

When I create a graph after using range.copy and range.paste it leaves the paste range selected, and then when I create a graph a few lines later, it uses the selection as the first series in the plot. I can delete the series, but is there a more elegant way to do this? I tried

Set selection = nothing

但是它不允许我设置选择.我还尝试了selection.clear,但是这只是清除了最后选择的单元格,并且仍然在绘图中添加了额外的序列.

but it won't let me set selection. I also tried selection.clear, but that just cleared the last cells that were selected, and still added an extra series to the plot.

推荐答案

Cells(1,1).Select

它将带您到单元格A1,从而取消您现有的选择.

It will take you to cell A1, thereby canceling your existing selection.

这篇关于对Excel进行编程时将选择设置为“无"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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