在VBA中相交(ActiveCell,Range()) [英] Intersect(ActiveCell,Range()) in VBA

查看:131
本文介绍了在VBA中相交(ActiveCell,Range())的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在使用VBA从Excel中自动化PPT幻灯片.我有50多个幻灯片和100多个表.如果更改表中的值,它将反映在PPT幻灯片中.我已经使用ActiveCell编写了这样的代码

Hi All,
Am working in Automation of PPT Slides from Excel using VBA.I have more than 50 slides,and more than 100 tables.If I change values in Tables it should reflect in PPT slides.I have written code using ActiveCell like This

Public Sub UpdatePPT_Click()
  Dim MyPath As String

  MyPath = InputBox("Enter the path")
  If Not Intersect(ActiveCell, Range("C145:D152")) Is Nothing Then
  Table7.updatetable7 (MyPath)
  End If
  If Not Intersect(ActiveCell, Range("C271:D273")) Is Nothing Then
  Table15_21.updatetable15 (MyPath)
  End If
  If Not Intersect(ActiveCell, Range("C283:X312")) Is Nothing Then
  Table15_21.updatetable16_18 (MyPath)
  End If
  End Sub



我的问题是如果我更改Range("C145:D152")中的一个单元格值,而Range("C271:D273") ActiveCell中的另一个值取我更改的最后一个范围.但是我想要两个范围中都更改的值,如何解决呢? br/>

在此先感谢.



My issue is if I change one cell value in the Range("C145:D152") and another value in Range("C271:D273") ActiveCell takes the last range in which I Changed.But I want both the values Which gets changed in both ranges,How to solve this?


Thanks in Advance.

推荐答案

按定义,ActiveCell是当前活动工作表上的当前活动单元格.如果您想每次进行修改时都检查更新,也许您应该在工作表中的Change事件中编写代码...

HTH
By definition, the ActiveCell is the currently active cell on the currently active work sheet. If you want to check for updates every time there is a modification, perhaps you should write your code in the work sheet Change event...

HTH


这篇关于在VBA中相交(ActiveCell,Range())的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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