不同单元格中的函数输出 [英] Function Output in Different Cell

查看:39
本文介绍了不同单元格中的函数输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在一个单元格中编写一个函数,然后使用该单元格的地址作为参考点,我想在Sheet2上更改单元格的值.本质上,我试图使一个函数产生两个不同的输出,每个输出在不同的工作表上.这是我到目前为止的内容:

I'm trying to write a function in one cell, and then using that cell's address as a reference point, I'd like to change the value of a cell on Sheet2. Essentially, I'm attempting to make a function yield two different outputs, each output on a different sheet. Here's what I have so far:

Function test() As Variant
    Application.Caller.Worksheet.Cells(Application.Caller.Row,Application.Caller.Column).Row
    Application.Caller.Worksheet.Cells(Application.Caller.Row, Application.Caller.Column).Column
    Sheet2.Cells(a + 1, b + 1).Value = 8
End Function

此操作的目标是在Sheet1的单元格A1中键入"= TEST()",A1等于零,而Sheet2上的单元格B2等于8.我听说有传言说Excel根本不允许UDF.影响到除编写单元之外的其他任何单元的更改,但是我真的不想相信这种谣言!

The goal with this is to type "=TEST()" in cell A1 on Sheet1, and A1 would equal zero while cell B2 on Sheet2 would equal 8. I've heard rumors that Excel simply won't allow a UDF to affect change to any other cell other than the one in which it was written, but I really don't want to believe that rumor!

推荐答案

可以结合使用功能(UDF)事件宏.

UDF将在 A1 中放置一个值,事件宏将检测到此情况并更改另一张纸上的单元格.

The UDF would place a value in A1 and the event macro would detect this occurrence and change the cell on the other sheet.

这篇关于不同单元格中的函数输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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