I have built VBA code that links cell contents from one Excel sheet <code style="font-style: inherit; font-variant: inherit; font-weight: inherit; margin: 0px; padding: 1px 5px; border: 0px; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; background-color: rgb(239, 240, 241); white-space: pre-wrap;">Employee Form</code> to another worksheet <code style="font-style: inherit; font-variant: inherit; font-weight: inherit; margin: 0px; padding: 1px 5px; border: 0px; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; background-color: rgb(239, 240, 241); white-space: pre-wrap;">Employee Database</code> in the same workbook as below:
The code works well, but how to modify the code now that these sheets are in separate Excel files? The new Excel files are the same as the respective names of these worksheets.
Thanks!
HTML:
Sub Submit_Form()
Dim LastRow AsLong, ws As Worksheet
Set ws = Sheets("Employee Database")
LastRow = ws.Range("A"& Rows.Count).End(xlUp).Row +1
ws.Range("A"& LastRow).Value = Worksheets("Employee Form").Range("D7").Value
....
ws.Range("Z"& LastRow).Value = Worksheets("Employee Form").Range("AB").Value
EndSub
The code works well, but how to modify the code now that these sheets are in separate Excel files? The new Excel files are the same as the respective names of these worksheets.
Thanks!