dougmarkham
Active Member
- Joined
- Jul 19, 2016
- Messages
- 252
- Office Version
- 365
- Platform
- Windows
Hi folks,
Situation: I have a specific range---$F$7:$F$13---that I need to copy from all worksheets except two worksheets: sh.name "MACRO" and sh.name "ExtraData". As I don't know how many worksheets I might have to copy $F$7:$F$13 from, I found this macro to faciliate the copy/paste.
Would anybody be able to help me modify Case Is <> "MACRO" in the above coding so that it excludes both sh.name "MACRO" and sh.name "ExtraData" from the copy function?
Kind regards,
Doug
Situation: I have a specific range---$F$7:$F$13---that I need to copy from all worksheets except two worksheets: sh.name "MACRO" and sh.name "ExtraData". As I don't know how many worksheets I might have to copy $F$7:$F$13 from, I found this macro to faciliate the copy/paste.
Code:
Public Sub m() Dim lRow As Long
Dim sh As Worksheet
Dim shArc As Worksheet
Set shArc = ThisWorkbook.Worksheets("ExtraData")
For Each sh In ThisWorkbook.Worksheets
Select Case sh.Name
[COLOR=#0000ff][B] Case Is <> "MACRO"[/B][/COLOR]
lRow = shArc.Range("A" & Rows.Count).End(xlUp).Row + 1
sh.Range("$F$7:$F$13").Copy
shArc.Range("A" & lRow).PasteSpecial
End Select
Next
Application.CutCopyMode = False
Set shArc = Nothing
Set sh = Nothing
End Sub
Would anybody be able to help me modify Case Is <> "MACRO" in the above coding so that it excludes both sh.name "MACRO" and sh.name "ExtraData" from the copy function?
Kind regards,
Doug