I am trying to save time inputting data by transferring data from one workbook, into another (preferably, straight onto a userform that I have initiated the copy from).
So I have a button my form which initiates the below;
Sub CopyRangeToAnotherSheet()
Dim wbThis As Workbook
Dim wbTarget As Workbook
With Application
.ScreenUpdating = True
.EnableEvents = False
End With
Set wbThis = Workbooks.Open("SOURCEWORKBOOKPATH")
wbThis.Sheets("Sheet1").Range("CELLNAME").Copy
Set wbTarget = ThisWorkbook
UserForm_Initialize
wbTarget.Forms("UserForm1").Range("DESTFORMFIELD").PasteSpecial
Paste:=xlPasteValues
wbThis.Close
UserForm_Initialize
End Sub
I have managed to copy from one workbook to another workbook fine, however I want the data copied into the form textboxes.
It's erroring on
wbTarget.Forms("UserForm1").Range("DESTFORMFIELD").PasteSpecial
but I can't seem to figure out the syntax.