小编Vik*_*ren的帖子

在VBA中返回,没有达到我的预期

Public Function GetRowToWriteOn(ByVal SheetName As String, ByVal id As Integer) As Integer
    LastRow = ActiveSheet.UsedRange.Rows.Count
    myarray = Sheets(SheetName).Range("d7:d" & LastRow).Value
    For row = 1 To UBound(myarray, 1)
        If (myarray(row, 1) = id) Then
            Return row
        End If
    Next
End Function
Run Code Online (Sandbox Code Playgroud)

IDE说预期声明结束,我该怎么做我想要的?(返回id相同的行?)

我对VBA一点也不熟悉,但是当我从微软看这个例子时,这应该有用吗?:

Return语句同时指定返回值并退出函数.以下示例显示了这一点.

Function myFunction(ByVal j As Integer) As Double
   Return 3.87 * j
End Function
Run Code Online (Sandbox Code Playgroud)

excel vba return excel-vba

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

元组类型内容python

我可以以某种方式看到元组内容的类型和大小吗?我希望输出类似于:

(str, list, int) 或者任何可能的东西(只是打印它们很难,因为有嵌套列表)

x = someSecretTupleFromSomewhereElse
print type(x)

<(type 'tuple')>
Run Code Online (Sandbox Code Playgroud)

python types tuples instanceof

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

从累计值到R中的单个值

sample1 <- c(9,9,24,24,27,27,39,45,54,54,54,57,57,57,57,66,66,69,75,81,90,102,105,108,120,120,123)
Run Code Online (Sandbox Code Playgroud)

我该怎么做到(9,0,15,0,3,0 ......)等等?这个程序叫什么?

statistics r sample accumulate

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

加入其余的字符串数组

private static string SetValue(string input, string reference)
{
    string[] sentence = input.Split(' ');
    for(int word = 0; word<sentence.Length; word++)
    {
        if (sentence[word].Equals(reference, StringComparison.OrdinalIgnoreCase))
        {
            return String.Join(" ", sentence.subarray(word+1,sentence.Length))
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

如何sentence.subarray(word+1,sentence.Length)轻松完成或以其他方式完成此操作?

c# arrays join substring

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

ArrayList容量,哪个更好?C#

我今天的输入大约是450,未来可能会增加.(有时它运行时少于450,可能是100或20)

对我来说更好:

  • 没有设定容量
  • 设定容量低(100)
  • 设定容量低于450
  • 设定容量超过450
  • 将容量设定在450以上
  • 将容量设置为高于预期的容量(多80%?,两次?)

使用n作为增加的数量(不是实际的复杂性)我是,将它设置为低于预期n = 440或者某些东西将给我"复杂性"n + 2n =(3n)

而如果我把它略高于(n = 460)就会给出n

另外,如果我设置n = 800给我一个高n(几乎2n)(高但我然后使用TrimToSize使其更好?

什么是最好的选择?

c# arraylist capacity

0
推荐指数
1
解决办法
836
查看次数