Forum Discussion
can you help me vba
I'm clumsy in English
How can I correct this array parameter
Option Explicit
Sub main()
Dim i, j, e As Long
Dim arr, arrMinus As Variant
Dim rng As Range
'Option Base 1 'erring :
arr = arrB()
e = UBound(arr) 'e = UBound(arr()) 괄오하면 틀림
arrMinus = minus(arr()) 'erring ;
'arrMinus = minus(arr() ) As Variant 'erring
e = UBound(arrMinus) 'e = UBound(arr()) 괄오하면 틀림
Set rng = ActiveSheet.Range("z1")
rng.Resize(1048536, 1).Clear
rng.Resize(e, 2) = arrMinus
End Sub
Function minus(arr())
Dim i, j, e As Long
Dim arr As Variant
Dim rng As Range
e = UBound(arr) 'arr() 괄오하면 틀림
ReDim arr(e, 2)
For i = 1 To e
If InStr(arr(i, 1), "ì›”") Then
arr(i + 1, 2) = arr(i + 1, 2) * 100
End If
Next
minus = arr
End Function
Function arrB()
Dim e, i, j As Long
Dim rng As Range
Dim arr As Variant
e = ActiveSheet.Range("a1048536").End(xlUp).Row
Set rng = ActiveSheet.Range("c1:d" & e)
arr = rng
arrB = arr
End Function