I have the below code which simply copies a selection of text and then pastes it into a sheet in another workbook.
For ease, lets call the two workbooks a user and master. The code is all in the 'user' workbook, when I step through the 'Enter and Store' macro I get to the row where the 'master' workbook opens without issue but then with the next press of F8 it jumps back to the
Can anyone help please?
For ease, lets call the two workbooks a user and master. The code is all in the 'user' workbook, when I step through the 'Enter and Store' macro I get to the row where the 'master' workbook opens without issue but then with the next press of F8 it jumps back to the
Sub Enter_and_store()
line and then subsequent F8's run through all of the code again rather than selecting the 'DATA' sheet. If I manually move the process to the point where it selects the 'DATA' sheet, the rest of the process works perfectly. The last part of the code using the FORM sheet is back in the 'user' workbook again.Can anyone help please?
VBA Code:
Sub Enter_and_store()
'
Range("C2:C6").Select
Selection.Copy
Set wbk = Workbooks.Open("Master workbook filepath")
Sheets("DATA").Select
Range("A1048576").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
ActiveWorkbook.Save
ActiveWorkbook.Close
Sheets("FORM").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("C2").Select
End Sub