我已经调整了您的代码以适用于字符串和函数以及我希望的其他任何东西(仍在测试)。
测试产生了很多问题,但首先想到的是 2:
您可以使用哪些其他方式来执行/处理参数并返回所需的结果;
一个。正如我所做的那样。不像我所做的那样(即不同)。
非常感谢 Rick Rothstein MrExcel MVP 和 SO 上的许多其他人为实现这一目标提供了支持和帮助。
Function MOVEME27(a As Variant, b As Variant, Optional CELLR As Variant, Optional cellq As Variant) '21/05/2018 works copied to ar4' 03/06/2019 23:30 was cellr as range , cellq as range - changed to variants
Dim WTVR1 As Variant '' ''20/05/2019'' '09/06/2019 Code by S Tzortzis/David Wooley
Dim WTVR2 As Variant
Dim P As String
Dim P1 As String
Dim bb As String
Dim bb1 As String
Dim A1 As Long
Dim A2 As Long
Dim c As String
'x' a = Evaluate(a)
P = Chr(34) & a & Chr(34)
P2 = Chr(34) & [P] & Chr(34)
bb = Chr(34) & b & Chr(34)
bb1 = Chr(34) & [bb] & Chr(34)
c = Chr(34) & CELLR & Chr(34)
f = Chr(34) & callq & Chr(34)
'P2 = Chr(34) & "'''" & [P] & "'''" & Chr(34)
'p1 = Chr(34) & p & Chr(34)
''WTVR1 = "MOVEUS1(" & Application.Caller.Offset(0, 2).Address(False, False) & "," & Chr(34) & P2 & Chr(34) & "," & b & ")"
WTVR1 = "MOVEUS11h(" & Application.Caller.Offset(0, 2).Address(False, False) & "," & [P2] & "," & [bb1] & ")"
Evaluate WTVR1
WTVR2 = "MOVEUS22h(" & Application.Caller.Offset(0, 1).Address(False, False) & "," & [P2] & "," & [bb1] & ")" ' used or be adjacent - maybe redo rhat pr put a GO TO sub. '' ''20/05/2019''
Evaluate WTVR2
A1 = cellq.Row
A2 = cellq.Column
CELLRR = Chr(34) & CELLR & Chr(34)
CELLRR1 = Chr(34) & [CELLRR] & Chr(34)
cellqq = Chr(34) & cellq & Chr(34)
cellqq1 = Chr(34) & [cellqq] & Chr(34)
''wtvr3 = "CopyFrom.Parent.Evaluate CopyOver234h(" & c & "," & f & ")" ''''20190531 1929
wtvr31 = "MOVEUS33h(" & Application.Caller.Offset(A1 - ActiveCell.Row + 1, A2 - ActiveCell.Column).Address(False, False) & "," & [CELLRR] & "," & [cellqq] & ")"
Evaluate wtvr31
MOVEME27 = "Hello world " & " / " & WTVR1 & " / " & WTVR2 & "\\\\\/////" & wtvr31 & "\\\\\/////---" & ActiveCell.Row - A1 & "//////---" & ActiveCell.Column - A2
' DO AS WHATVER = "MOVEUS3(" APPLICATION.CALLER.OFFSET(THE ROW & COLUMN IE CELL YOU REFERENCES IN a as variant (copy from)'
'with ="" in sub 30052019 19:28
'CopyFrom.Parent.Evaluate "CopyOver2(" & CELLR.Address(False, 1) & "," & CELLR.Address(False, False) & ")" ''''2019050 1929
End Function
Private Sub MOVEUS11h(CELL1 As Range, G1 As Variant, G2 As Variant)
'[ak333] = a
CELL1 = Chr(34) & G1 & Chr(34) & "B" & "//" & G2
End Sub
Private Sub MOVEUS22h(CELL2 As Range, G3 As Variant, G4 As Variant)
CELL2 = Chr(34) & G3 & Chr(34) & "<>" & G4
End Sub
'' with chr(34) arond the p's and a's in sub or fucntion changes behavior. thinking of doing if a is string, then a=x , x as string, if not kep as variant
''27/05/2019 :(
'''''30/05/2019 .....'''''''
'------------------------------------------------------------------------------- ADD THIS 30052019 -------------------------------
'private sub Movus3(cellfrom as range, cellto as range)
'End Sub
Private Sub moveus33h(cell3 As Range, CopyFrom As Variant, copyTo As Variant) ''''2019050 1929 ''' 03062019 change ema back to as Range here. :)
'' copyTo.Value = CopyFrom.Value ''''2019050 1929
''CopyFrom.Value = ""
cell3 = CopyFrom 'Chr(34) & CopyFrom & Chr(34)
End Sub ''''2019050 1929