本文介绍了Excel VBA:如何扩展给定当前选择的范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一些例子:

E18-(1,1) &":" &E18+(1,1)

我的目的是保持范围的选择 E18 (value = B),并将选择范围扩展到 D16:F20

My intent is to keep the selection of range E18 (value = B) and extend the selection to D16:F20.

如果我的单元格范围为 E18 ,我想将范围扩展到 D16:F20 ,我该怎么做?

If I have a cell's range of E18 and I want to extend the range to D16:F20, how can I do this?

推荐答案

Range(Cells(WorksheetFunction.Max(1, Selection.Row - 1), _
      WorksheetFunction.Max(1, Selection.Column - 1)), _
      Cells(WorksheetFunction.Min(Selection.Worksheet.Rows.Count, _
      Selection.Row + 1), _
      WorksheetFunction.Min(Selection.Worksheet.Columns.Count, _
      Selection.Column + 1))).Select


$ b $($) b

upd:感谢Siddharth Rout形成我的msg

upd: thanks Siddharth Rout for formating my msg

这篇关于Excel VBA:如何扩展给定当前选择的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 16:32