“如果则在VBA中声明用数字填充单元格" [英] "if then statement in VBA to fill cell with number"

查看:265
本文介绍了“如果则在VBA中声明用数字填充单元格"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在VBA中使用if then语句",我正在编写一个程序,如果变量达到某个值,该程序将一个数字放入Excell的单元格中.我知道如何声明变量,但是如果A1 = 34,我不知道如何告诉excel写x.谢谢

"if then statement in VBA" I'm writing a program that puts a number in a cell in Excell if a variable reaches a certain value. I understand how to declare variables but I don't know how to tell excel to write x if A1 =34. Thanks

推荐答案

目前尚不清楚您想做什么,但是假设您要将变量x的当前值写入单元格B2中...如果单元格A1是34.

It's not clear what you wish to do, but let's say you want to write the current value of your variable, x, into cell B2... if cell A1 is 34.

在上述情况下,您可以这样做:

In the above case, you would do this:

If [a1] = 34 then [b2] = x

这篇关于“如果则在VBA中声明用数字填充单元格"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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