VBA Excel宏将一个输入整数写入单元格 [英] VBA Excel macro writing an input integer into a cell

查看:264
本文介绍了VBA Excel宏将一个输入整数写入单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在自己写一个快速应用程序 - 第一个项目,但是我试图找到VBA代码,将输入字符串的结果写入Excel中的命名单元格。



例如,输入框询问您要添加到列表中的作业号问题,然后用户输入FX1234356等参考号。然后,宏需要将该信息写入单元格,然后我可以使用它来完成宏(基本上是在某些数据中搜索)。

解决方案

您可以使用VBA中的Range对象来设置命名单元格的值,就像任何其他单元格一样。

  Range(C1)。Value = Inputbox(您要添加到列表中的工作号)

其中C1是要更新的单元格的名称。



我的Excel VBA有点老且硬硬,所以有可能在更新版本的Excel中做一个更好的方法。


I am writing a quick application myself - first project, however I am trying to find the VBA code for writing the result of an input string to a named cell in Excel.

For example, a input box asks the question "Which job number would you like to add to the list?"... the user would then enter a reference number such as "FX1234356". The macro then needs to write that information into a cell, which I can then use to finish the macro (basically a search in some data).

解决方案

You can use the Range object in VBA to set the value of a named cell, just like any other cell.

Range("C1").Value = Inputbox("Which job number would you like to add to the list?)

Where "C1" is the name of the cell you want to update.

My Excel VBA is a little bit old and crusty, so there may be a better way to do this in newer versions of Excel.

这篇关于VBA Excel宏将一个输入整数写入单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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