storing code in a column and using it

北城以北 提交于 2020-01-06 06:06:00

问题


I have a column that has data, such as year(date) or date-365.

How do I use this text as code, not as text? Meaning, I'd like to be able to do something like

 me.ProjectName="ddddd " & MyColumnWithCode

and get ddddd 2017 or ddddd 10/21/2016

I did google in every way I could think of and didn't get anything.


回答1:


You can use:

Me.ProjectName="ddddd " & Eval(MyColumnWithCode)

but not with your present code. It has to read:

Year(Date())
Date()-365



回答2:


Simply write

dddd = sheets("Sheet1").range("a1").value
me.ProjectName= str(ddddd) & MyColumnWithCode    'Str is used in case its a number


来源:https://stackoverflow.com/questions/46861816/storing-code-in-a-column-and-using-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!