PhilW_34
Board Regular
- Joined
- Jan 4, 2007
- Messages
- 128
- Office Version
- 365
- Platform
- Windows
Hello,
Sorry I couldn't come up with a better title.
I have two files open. Right now I'm manually updating this year's file with data from last year's. I have code which selects the worksheet I'm viewing and copies information into the second workbook. It is semi-efficient.
Is it possible to look at the worksheet name in file A and search for it in File B. When/if found, then copy data from that worksheet onto the same named worksheet in file A? I would want this to loop for all worksheets in workbook A. I have the code for copying and pasting. I don't have any idea how to take the worksheet name from File A, search then select the worksheet from Worksheet B. I feel like I'm being clear as mud.
Any comments are welcome. Thank you for looking and giving my question some consideration.
Phil
Currently selecting each tab then running this code.
Sorry I couldn't come up with a better title.
I have two files open. Right now I'm manually updating this year's file with data from last year's. I have code which selects the worksheet I'm viewing and copies information into the second workbook. It is semi-efficient.
Is it possible to look at the worksheet name in file A and search for it in File B. When/if found, then copy data from that worksheet onto the same named worksheet in file A? I would want this to loop for all worksheets in workbook A. I have the code for copying and pasting. I don't have any idea how to take the worksheet name from File A, search then select the worksheet from Worksheet B. I feel like I'm being clear as mud.
Any comments are welcome. Thank you for looking and giving my question some consideration.
Phil
Currently selecting each tab then running this code.
Code:
Sub Copy_Paste_BetweenFiles()
Application.ScreenUpdating = False
DisplayAlerts = False
'Change file names as needed.
Windows("File B.xlsm").Activate
Range("A5:N10,A29:N29").Copy
Windows("FileA.xlsm").Activate
With Range("A4")
.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteComments, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End With
Application.ScreenUpdating = True
DisplayAlerts = True
End Sub