ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
12
返回列表 发新帖
楼主: beleqing

[求助] 160行数组存入数组中

[复制链接]

TA的精华主题

TA的得分主题

 楼主| 发表于 2024-1-10 12:20 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
wangg913 发表于 2024-1-10 11:03
myArray = Sheet1.Range("A1").CurrentRegion

这样为什么不行?

领导觉得数据藏在代码里,大部分人不懂,安全一些

TA的精华主题

TA的得分主题

发表于 2024-1-10 12:27 | 显示全部楼层
Sub ss()
Dim ar, i&, s$
ar = Sheet1.Range("A1:B161")
For i = 2 To UBound(ar)
    s = s & Chr(10) & "myArray(" & i - 1 & ", 1) = " & ar(i, 1)
    s = s & Chr(10) & "myArray(" & i - 1 & ", 2) = " & ar(i, 2)
Next
Sheet2.[a1] = s
End Sub

先生成代码字符串 s,再复制到代码窗口

TA的精华主题

TA的得分主题

发表于 2024-1-10 12:53 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
beleqing 发表于 2024-1-10 12:20
领导觉得数据藏在代码里,大部分人不懂,安全一些

那就写两行,然后复制300行,一个一个改数字。因为无论怎么实现,300多个数字是少不了要录入的

TA的精华主题

TA的得分主题

发表于 2024-1-10 12:59 | 显示全部楼层
  1. Function GetArray()
  2. Dim arr(1 To 160, 1 To 2) As Long
  3. arr(1, 1) = 7: arr(1, 2) = 92
  4. arr(2, 1) = 4: arr(2, 2) = 97
  5. arr(3, 1) = 10: arr(3, 2) = 90
  6. arr(4, 1) = 5: arr(4, 2) = 59
  7. arr(5, 1) = 10: arr(5, 2) = 34
  8. arr(6, 1) = 5: arr(6, 2) = 67
  9. arr(7, 1) = 8: arr(7, 2) = 71
  10. arr(8, 1) = 4: arr(8, 2) = 77
  11. arr(9, 1) = 3: arr(9, 2) = 75
  12. arr(10, 1) = 2: arr(10, 2) = 95
  13. arr(11, 1) = 9: arr(11, 2) = 95
  14. arr(12, 1) = 1: arr(12, 2) = 43
  15. arr(13, 1) = 8: arr(13, 2) = 43
  16. arr(14, 1) = 6: arr(14, 2) = 53
  17. arr(15, 1) = 2: arr(15, 2) = 83
  18. arr(16, 1) = 10: arr(16, 2) = 56
  19. arr(17, 1) = 3: arr(17, 2) = 28
  20. arr(18, 1) = 4: arr(18, 2) = 83
  21. arr(19, 1) = 7: arr(19, 2) = 44
  22. arr(20, 1) = 5: arr(20, 2) = 20
  23. arr(21, 1) = 4: arr(21, 2) = 53
  24. arr(22, 1) = 9: arr(22, 2) = 98
  25. arr(23, 1) = 10: arr(23, 2) = 49
  26. arr(24, 1) = 6: arr(24, 2) = 24
  27. arr(25, 1) = 1: arr(25, 2) = 30
  28. arr(26, 1) = 9: arr(26, 2) = 36
  29. arr(27, 1) = 10: arr(27, 2) = 97
  30. arr(28, 1) = 4: arr(28, 2) = 96
  31. arr(29, 1) = 9: arr(29, 2) = 81
  32. arr(30, 1) = 1: arr(30, 2) = 52
  33. arr(31, 1) = 3: arr(31, 2) = 44
  34. arr(32, 1) = 8: arr(32, 2) = 29
  35. arr(33, 1) = 2: arr(33, 2) = 48
  36. arr(34, 1) = 4: arr(34, 2) = 75
  37. arr(35, 1) = 6: arr(35, 2) = 50
  38. arr(36, 1) = 9: arr(36, 2) = 57
  39. arr(37, 1) = 9: arr(37, 2) = 75
  40. arr(38, 1) = 10: arr(38, 2) = 80
  41. arr(39, 1) = 1: arr(39, 2) = 28
  42. arr(40, 1) = 4: arr(40, 2) = 90
  43. arr(41, 1) = 8: arr(41, 2) = 93
  44. arr(42, 1) = 8: arr(42, 2) = 70
  45. arr(43, 1) = 8: arr(43, 2) = 16
  46. arr(44, 1) = 4: arr(44, 2) = 68
  47. arr(45, 1) = 6: arr(45, 2) = 34
  48. arr(46, 1) = 7: arr(46, 2) = 87
  49. arr(47, 1) = 10: arr(47, 2) = 100
  50. arr(48, 1) = 5: arr(48, 2) = 30
  51. arr(49, 1) = 5: arr(49, 2) = 16
  52. arr(50, 1) = 2: arr(50, 2) = 67
  53. arr(51, 1) = 2: arr(51, 2) = 95
  54. arr(52, 1) = 5: arr(52, 2) = 53
  55. arr(53, 1) = 9: arr(53, 2) = 72
  56. arr(54, 1) = 10: arr(54, 2) = 49
  57. arr(55, 1) = 6: arr(55, 2) = 35
  58. arr(56, 1) = 4: arr(56, 2) = 17
  59. arr(57, 1) = 9: arr(57, 2) = 72
  60. arr(58, 1) = 10: arr(58, 2) = 99
  61. arr(59, 1) = 7: arr(59, 2) = 74
  62. arr(60, 1) = 8: arr(60, 2) = 94
  63. arr(61, 1) = 9: arr(61, 2) = 11
  64. arr(62, 1) = 2: arr(62, 2) = 28
  65. arr(63, 1) = 7: arr(63, 2) = 80
  66. arr(64, 1) = 7: arr(64, 2) = 11
  67. arr(65, 1) = 10: arr(65, 2) = 60
  68. arr(66, 1) = 4: arr(66, 2) = 28
  69. arr(67, 1) = 8: arr(67, 2) = 59
  70. arr(68, 1) = 4: arr(68, 2) = 34
  71. arr(69, 1) = 5: arr(69, 2) = 24
  72. arr(70, 1) = 10: arr(70, 2) = 71
  73. arr(71, 1) = 10: arr(71, 2) = 68
  74. arr(72, 1) = 2: arr(72, 2) = 43
  75. arr(73, 1) = 7: arr(73, 2) = 89
  76. arr(74, 1) = 2: arr(74, 2) = 55
  77. arr(75, 1) = 2: arr(75, 2) = 67
  78. arr(76, 1) = 10: arr(76, 2) = 56
  79. arr(77, 1) = 4: arr(77, 2) = 97
  80. arr(78, 1) = 4: arr(78, 2) = 25
  81. arr(79, 1) = 9: arr(79, 2) = 55
  82. arr(80, 1) = 6: arr(80, 2) = 91
  83. arr(81, 1) = 9: arr(81, 2) = 23
  84. arr(82, 1) = 8: arr(82, 2) = 54
  85. arr(83, 1) = 5: arr(83, 2) = 22
  86. arr(84, 1) = 6: arr(84, 2) = 88
  87. arr(85, 1) = 1: arr(85, 2) = 38
  88. arr(86, 1) = 7: arr(86, 2) = 32
  89. arr(87, 1) = 7: arr(87, 2) = 83
  90. arr(88, 1) = 6: arr(88, 2) = 27
  91. arr(89, 1) = 4: arr(89, 2) = 54
  92. arr(90, 1) = 2: arr(90, 2) = 33
  93. arr(91, 1) = 4: arr(91, 2) = 91
  94. arr(92, 1) = 3: arr(92, 2) = 58
  95. arr(93, 1) = 2: arr(93, 2) = 77
  96. arr(94, 1) = 5: arr(94, 2) = 49
  97. arr(95, 1) = 9: arr(95, 2) = 10
  98. arr(96, 1) = 10: arr(96, 2) = 31
  99. arr(97, 1) = 1: arr(97, 2) = 51
  100. arr(98, 1) = 4: arr(98, 2) = 64
  101. arr(99, 1) = 3: arr(99, 2) = 30
  102. arr(100, 1) = 5: arr(100, 2) = 30
  103. arr(101, 1) = 8: arr(101, 2) = 17
  104. arr(102, 1) = 1: arr(102, 2) = 95
  105. arr(103, 1) = 2: arr(103, 2) = 82
  106. arr(104, 1) = 8: arr(104, 2) = 14
  107. arr(105, 1) = 1: arr(105, 2) = 50
  108. arr(106, 1) = 7: arr(106, 2) = 38
  109. arr(107, 1) = 7: arr(107, 2) = 87
  110. arr(108, 1) = 6: arr(108, 2) = 62
  111. arr(109, 1) = 10: arr(109, 2) = 64
  112. arr(110, 1) = 10: arr(110, 2) = 80
  113. arr(111, 1) = 7: arr(111, 2) = 94
  114. arr(112, 1) = 5: arr(112, 2) = 84
  115. arr(113, 1) = 4: arr(113, 2) = 53
  116. arr(114, 1) = 4: arr(114, 2) = 16
  117. arr(115, 1) = 7: arr(115, 2) = 65
  118. arr(116, 1) = 10: arr(116, 2) = 53
  119. arr(117, 1) = 2: arr(117, 2) = 66
  120. arr(118, 1) = 3: arr(118, 2) = 16
  121. arr(119, 1) = 7: arr(119, 2) = 12
  122. arr(120, 1) = 10: arr(120, 2) = 92
  123. arr(121, 1) = 7: arr(121, 2) = 61
  124. arr(122, 1) = 7: arr(122, 2) = 43
  125. arr(123, 1) = 4: arr(123, 2) = 85
  126. arr(124, 1) = 10: arr(124, 2) = 63
  127. arr(125, 1) = 9: arr(125, 2) = 82
  128. arr(126, 1) = 2: arr(126, 2) = 57
  129. arr(127, 1) = 8: arr(127, 2) = 83
  130. arr(128, 1) = 5: arr(128, 2) = 23
  131. arr(129, 1) = 8: arr(129, 2) = 39
  132. arr(130, 1) = 8: arr(130, 2) = 68
  133. arr(131, 1) = 6: arr(131, 2) = 25
  134. arr(132, 1) = 5: arr(132, 2) = 67
  135. arr(133, 1) = 9: arr(133, 2) = 46
  136. arr(134, 1) = 8: arr(134, 2) = 43
  137. arr(135, 1) = 10: arr(135, 2) = 86
  138. arr(136, 1) = 2: arr(136, 2) = 64
  139. arr(137, 1) = 1: arr(137, 2) = 61
  140. arr(138, 1) = 2: arr(138, 2) = 37
  141. arr(139, 1) = 9: arr(139, 2) = 23
  142. arr(140, 1) = 4: arr(140, 2) = 37
  143. arr(141, 1) = 7: arr(141, 2) = 53
  144. arr(142, 1) = 1: arr(142, 2) = 95
  145. arr(143, 1) = 7: arr(143, 2) = 70
  146. arr(144, 1) = 6: arr(144, 2) = 65
  147. arr(145, 1) = 4: arr(145, 2) = 12
  148. arr(146, 1) = 10: arr(146, 2) = 10
  149. arr(147, 1) = 4: arr(147, 2) = 67
  150. arr(148, 1) = 4: arr(148, 2) = 12
  151. arr(149, 1) = 6: arr(149, 2) = 85
  152. arr(150, 1) = 9: arr(150, 2) = 88
  153. arr(151, 1) = 3: arr(151, 2) = 100
  154. arr(152, 1) = 10: arr(152, 2) = 56
  155. arr(153, 1) = 7: arr(153, 2) = 92
  156. arr(154, 1) = 2: arr(154, 2) = 76
  157. arr(155, 1) = 5: arr(155, 2) = 18
  158. arr(156, 1) = 2: arr(156, 2) = 84
  159. arr(157, 1) = 7: arr(157, 2) = 60
  160. arr(158, 1) = 2: arr(158, 2) = 78
  161. arr(159, 1) = 5: arr(159, 2) = 68
  162. arr(160, 1) = 3: arr(160, 2) = 33
  163. GetArray = arr
  164. End Function
复制代码

评分

1

查看全部评分

TA的精华主题

TA的得分主题

发表于 2024-1-10 20:00 | 显示全部楼层
微软提供的方法工作表元素直接读入数组应该最简单的。

评分

1

查看全部评分

TA的精华主题

TA的得分主题

发表于 2024-1-11 14:06 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

TA的精华主题

TA的得分主题

发表于 2024-1-11 15:29 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2024-1-13 19:10 | 显示全部楼层
防小白的 障眼法 就是用 js 混淆(密文法)


1.png

111.zip

1.06 KB, 下载次数: 2

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-11-19 09:26 , Processed in 0.044092 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表