If I attempt to encapsulate one line, the compiler rejects the encapsulation
The critical code is the following:
Dim WrkBkPtr as object
Dim WrkShtPtr as object
Set wrkBkPtr = ThisWorkbook
Set WrkShtPtr = WrkBkPtr.Worksheets(1)
Const R as long = 2
Dim C() as long
Dim U() as long
C(i) = 22
U(I) =33
WrkShtPtr.Cells(R, C(i)) = U(i) This is the line I will be encapsulating
The complier is very happy with the above.
But if I encapsulate the above last line resulting in the last line being:
PrintData (WrkShtPtr,R, C(i)), U(i))
“The compiler issues a “syntax” error even though the passed parameters have the exact same data type within the subroutine, PrintData:
Private sub PrintData (WrkShtPtr as object, RowStart as long, ColStart as long, UnpackedValue as long)
WrkShtPtr.cells(Rowstart,ColStart) = UnpackedValue
end sub
The critical code is the following:
Dim WrkBkPtr as object
Dim WrkShtPtr as object
Set wrkBkPtr = ThisWorkbook
Set WrkShtPtr = WrkBkPtr.Worksheets(1)
Const R as long = 2
Dim C() as long
Dim U() as long
C(i) = 22
U(I) =33
WrkShtPtr.Cells(R, C(i)) = U(i) This is the line I will be encapsulating
The complier is very happy with the above.
But if I encapsulate the above last line resulting in the last line being:
PrintData (WrkShtPtr,R, C(i)), U(i))
“The compiler issues a “syntax” error even though the passed parameters have the exact same data type within the subroutine, PrintData:
Private sub PrintData (WrkShtPtr as object, RowStart as long, ColStart as long, UnpackedValue as long)
WrkShtPtr.cells(Rowstart,ColStart) = UnpackedValue
end sub