如何在Excel中创建GUID? [英] How to create a GUID in Excel?
问题描述
我需要一个将GUID添加到Excel中单元格的功能.我发现了之前关于stackoverflow的问题,但是它没有用.它建议使用以下功能:
I need a function to add a GUID to cells in excel. I found this previous question on stackoverflow, but it is not working. It suggests the following function:
=CONCATENATE(DEC2HEX(RANDBETWEEN(0,4294967295),8),"-",DEC2HEX(RANDBETWEEN(0,65535),4),"-
",DEC2HEX(RANDBETWEEN(16384,20479),4),"-",DEC2HEX(RANDBETWEEN(32768,49151),4),"-
",DEC2HEX(RANDBETWEEN(0,65535),4),DEC2HEX(RANDBETWEEN(0,4294967295),8))
我无法使用连接方法,因此尝试使用&"该图反正可以串联起来.这似乎可行,但是随后我在第二个DEX2HEX块上遇到了一个莫名其妙的错误:DEC2HEX(RANDBETWEEN(0,65535),4). Excel公式评估程序说这是无效的,但我似乎根本无法弄清原因.有任何想法吗?
I have been unable to get the concatenate method to work, and so tried it using the "&" figure to concatenate anyway. That seemed to work, but then I get an inexplicable error on the second DEX2HEX block: DEC2HEX(RANDBETWEEN(0,65535),4). The Excel formula evaluator says it's invalid, but I can't seem to figure out why at all. Any ideas?
推荐答案
我正在使用v.2013 excel vba宏代码中的以下功能
I am using the following function in v.2013 excel vba macro code
Public Function GetGUID() As String
GetGUID = Mid$(CreateObject("Scriptlet.TypeLib").GUID, 2, 36)
End Function
这篇关于如何在Excel中创建GUID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!