本文介绍了使用范围函数excel与变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 范围(一个& aa + 4:C5& bb + 4)。选择

其中aa和bb是变量。



谢谢!

解决方案

尝试使用:

  Range(A+ Strings.Trim(Str(aa + 4))+:C+ Strings.Trim + 4)))。选择

或这个:

 范围(单元格(aa + 4,1),单元格(bb + 4,3))。选择

另外还有一篇我在博客上写的关于使用VBA介绍这个主题的Excel中引用范围的不同方法的文章。


I would like to use variables within the range function, to assign adaptive range selection in excel VBA.

Range("A"&aa+4":C5"&bb+4).Select

where aa and bb are variables.

Thanks !

解决方案

Try using this:

Range("A" + Strings.Trim(Str(aa + 4)) + ":C" + Strings.Trim(Str(bb + 4))).Select

or this:

Range(Cells(aa + 4, 1), Cells(bb + 4, 3)).Select

Also there is an article I've written on my blog about the different methods of referencing ranges in excel using VBA which covers this topic. Referencing Ranges in Excel Using VBA

这篇关于使用范围函数excel与变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 22:51
查看更多