小编Fub*_*dis的帖子

按位置从数组中删除元素

我试图弄清楚如何从数组中删除某个元素(如果它位于某个位置)。我们还需要调整数组的大小。为了使示例更简单,让我们尝试删除数组中位置一的任何颜色(“绿色”、“蓝色”、“红色”)。

Sub Example()

Dim pos
colors = Array("Green", "Blue", "Red")

pos = 1

colors(pos).Delete 'obviously this doesn't work but what would the correct protocol be?

 End Sub
Run Code Online (Sandbox Code Playgroud)

arrays excel vba

3
推荐指数
2
解决办法
1万
查看次数

Windows Task Scheduler-打开Excel文件“您如何打开此文件”

我试图在Windows Task Scheduler中设置一个基本任务,该任务每天打开一个Excel文件。我过去已经成功完成此操作,但是由于某些原因,当我尝试打开文件时,在使用的Windows Server 2012 OS上,系统提示您如何打开这种类型的文件?

任务计划程序示例

有没有一种方法可以自动选择Excel作为用于运行此任务的文件的程序?

excel scheduled-tasks windows-server-2012

3
推荐指数
1
解决办法
1万
查看次数

检查数组 VBA 的值

我试图确保我构建的数组具有我期望的值。

Cards 数组应该填充 Shoe 数组。

当我计算数组的值时,我得到了预期的 104,但是当我将这些值粘贴到 Excel 工作表中时,只填充了 13 个单元格。

有没有一种简单的方法来检查数组的内容?

Sub CreateShoe()

Dim decks As Integer
decks = 2


Dim Cards As Variant
Dim shoe As Variant
Dim cnt As Integer


Cards = Array(2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, "A")
ReDim shoe(1 To 52 * decks)

cnt = 1

For i = LBound(Cards) To UBound(Cards)
shoe(cnt) = Cards(i)
cnt = cnt + 1
Next i

Range("A1:A99") = WorksheetFunction.Transpose(shoe)

End Sub
Run Code Online (Sandbox Code Playgroud)

arrays excel vba

2
推荐指数
1
解决办法
1万
查看次数