Hello! I want to create a dynamic function in VBA wherein I provide the name range, column number and row number. As per the values provided, the range should be hard pasted. This is what I did but it is giving an error:
This is how I am using it:Public Function HardPaste(Table_Range As Variant, Col_Num As Integer, Row_Num As Integer) Table_Range(Row_Num, Col_Num).Select Selection.PasteSpecial Paste:=xlPasteValues End Function
Sub Test() ThisWorkbook.Names.Add Name:="CQ_Table_Range", RefersTo:=ThisWorkbook.Sheets("2019_QF3").Range("CQ_Table_Start").CurrentRegion HardPaste(CQ_Table_Range,1,4) End Sub
The error I am getting is Compile Error: Expected :=
Thanks in advance for your help!


Reply With Quote