根据另一个数组的值更新数组
试图创建一个子例程,用户复制并将食谱粘贴到一个细胞中,并且过敏原自动大写...例如(牛奶变成牛奶)。我的SA2数组只有空白值?
ps我知道我可以使用替换 /查找参数,我想通过一个阵列来进行个人发展。
Sub Allergen()
Dim nr As Integer
Dim r As Range
Dim sa As Variant
Dim sa2 As Variant
Dim i As Integer
nr = WorksheetFunction.CountA(Columns("E:E"))
sa = Split(Sheets("Sheet1").Range("E" & nr).Offset(-1, 0))
sa2 = Split(Sheets("Sheet1").Range("E" & nr).Offset(-1, 0))
ReDim Preserve sa2(0 To UBound(sa))
For i = LBound(sa) To UBound(sa)
If sa(i) = "Milk" Then
sa2(i) = "MILK"
End If
Trying to create a subroutine where a user copies and paste a recipe into a cell, and the allergens become automatically capitalised...e.g. (Milk becomes MILK). My SA2 array just holds blank values?
PS I know I can use replace / find argument, I want to do it through an array just for personal development.
Sub Allergen()
Dim nr As Integer
Dim r As Range
Dim sa As Variant
Dim sa2 As Variant
Dim i As Integer
nr = WorksheetFunction.CountA(Columns("E:E"))
sa = Split(Sheets("Sheet1").Range("E" & nr).Offset(-1, 0))
sa2 = Split(Sheets("Sheet1").Range("E" & nr).Offset(-1, 0))
ReDim Preserve sa2(0 To UBound(sa))
For i = LBound(sa) To UBound(sa)
If sa(i) = "Milk" Then
sa2(i) = "MILK"
End If
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论