将输入整数写入单元格 [英] Writing an input integer into a cell
问题描述
我本人正在编写一个快速应用程序-第一个项目,但是我试图找到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.
例如,一个输入框询问问题您想添加到列表中的哪个作业号?" ...然后,用户将输入参考号,例如"FX1234356".然后,宏需要将该信息写入单元格中,然后我可以用它来完成宏(基本上是对某些数据的搜索).
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).
推荐答案
您可以在VBA中使用Range对象来设置命名单元格的值,就像其他任何单元格一样.
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?)
"C1"是您要更新的单元格的名称.
Where "C1" is the name of the cell you want to update.
我的Excel VBA有点旧而且坚固,因此在较新版本的Excel中可能会有更好的方法.
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.
这篇关于将输入整数写入单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!