Grumbledook
Technical User
I am trying to code in VBA a simple routine to copy selected cells in one workbook to selected cells in another. The routine is working but the copied data is displayed as #REF instead of numbers. Both Workbooks are formatted exactly the same. The Code is contained in a user form in Target Workbook. The user form asks for specific data and then opens the source workbook using user inputted data.
CODE:
Private Sub CommandButton1_Click()
'Open source workbook
Workbooks.Open Filename:="" & Collartext.Text & _ Surnametext.Text & Monthtext.Text & Yeartext.Text
'Select range and paste to target workbook
Call CopyRange
Application.CutCopyMode = False
End Sub
Sub CopyRange()
'Gets selected range from Source Workbook
Sheets("Sheet1").Activate
Range("E25:I25").Select
Selection.Copy
'Activates target workbook
ThisWorkbook.Activate
ActiveSheet.Range("D3:H3").Select
Selection.Paste
End Sub
Any ideas?
G.
CODE:
Private Sub CommandButton1_Click()
'Open source workbook
Workbooks.Open Filename:="" & Collartext.Text & _ Surnametext.Text & Monthtext.Text & Yeartext.Text
'Select range and paste to target workbook
Call CopyRange
Application.CutCopyMode = False
End Sub
Sub CopyRange()
'Gets selected range from Source Workbook
Sheets("Sheet1").Activate
Range("E25:I25").Select
Selection.Copy
'Activates target workbook
ThisWorkbook.Activate
ActiveSheet.Range("D3:H3").Select
Selection.Paste
End Sub
Any ideas?
G.