将主程式的值带到Function中的MySht、MyBase后,
希望Function计算出来的RC1、RC2、CC1、CC2能让主程式应用。
而我这个写法无法将Function的值让主程式使用,
请问程式码有那边需要修改呢?谢谢!!
程式码如下:
Sub 主程式()
Dim RC1 as Integer, RC2 as Integer, CC1 as Integer, CC2 as Integer
Call 范围计算("资料表", "AG")
Range("A" & RC1 & ":O" & RC2).Copy <-希望用Function的RC1、RC2的值
......
Range("Z" & CC1 & ":AD" & CC2).Copy
......
End Sub
Function 范围计算(ByRef Mysht As String, MyBase As String) as Integer
Dim RC1 as Integer, RC2 as Integer, CC1 as Integer, CC2 as Integer
Sheets(Mysht).Select
RC1 = Range(MyBase & ActiveSheet.Rows.Count).End(xlUp).Row
RC2 = xxxxx
CC1 = xxxxx
CC2 = xxxxx
End Function