MancmMonkee
New Member
- Joined
- Nov 21, 2018
- Messages
- 4
Hi there - bit of an Excel novice, but trying to get a Macro I have on a document updated so it ignores a few of the worksheets. The sheets to be ignored are just data, and the macro in question is a simple copy & paste job for some monthly tabs we have further in the document. Have tried to set the code so it ignored Sheets 1, 2 & 3 - but does all others - however it's just not working, so sure I've missed something!
Any help would be appreciated!
Any help would be appreciated!
Code:
Sub CopyYest()
Dim xsheet As Worksheet
For Each ws In Worksheets
If ws.Name <> "Sheet1" And ws.Name <> "Sheet2" And ws.Name <> "Sheet3" Then
Range("C4:C34").Select
Selection.Copy
Range("D4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("F4:F34").Select
Application.CutCopyMode = False
Selection.Copy
Range("G4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("I4:I34").Select
Application.CutCopyMode = False
Selection.Copy
Range("J4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("L4:L34").Select
Application.CutCopyMode = False
Selection.Copy
Range("M4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("O4:O34").Select
Application.CutCopyMode = False
Selection.Copy
Range("P4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("R4:R34").Select
Application.CutCopyMode = False
Selection.Copy
Range("S4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("U4:U34").Select
Application.CutCopyMode = False
Selection.Copy
Range("V4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("X4:X34").Select
Application.CutCopyMode = False
Selection.Copy
Range("Y4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AA4:AA34").Select
Application.CutCopyMode = False
Selection.Copy
Range("AB4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AD4:AD34").Select
Application.CutCopyMode = False
Selection.Copy
Range("AE4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AG4:AG34").Select
Application.CutCopyMode = False
Selection.Copy
Range("AH4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AJ4:AJ34").Select
Application.CutCopyMode = False
Selection.Copy
Range("AK4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll ToRight:=29
Range("AM4:AM34").Select
Application.CutCopyMode = False
Selection.Copy
Range("AN4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AP4:AP34").Select
Application.CutCopyMode = False
Selection.Copy
Range("AQ4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AS4:AS34").Select
Application.CutCopyMode = False
Selection.Copy
Range("AT4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AV4:AV34").Select
Application.CutCopyMode = False
Selection.Copy
Range("AW4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AY4:AY34").Select
Application.CutCopyMode = False
Selection.Copy
Range("AZ4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("BB4:BB34").Select
Application.CutCopyMode = False
Selection.Copy
Range("BC4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("BE4:BE34").Select
Application.CutCopyMode = False
Selection.Copy
Range("BF4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=72
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 18
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 3
Range("C76:C106").Select
Application.CutCopyMode = False
Selection.Copy
Range("D76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("F76:F106").Select
Application.CutCopyMode = False
Selection.Copy
Range("G76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("I76:I106").Select
Application.CutCopyMode = False
Selection.Copy
Range("J76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("L76:L106").Select
Application.CutCopyMode = False
Selection.Copy
Range("M76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("O76:O106").Select
Application.CutCopyMode = False
Selection.Copy
Range("P76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("R76:R106").Select
Application.CutCopyMode = False
Selection.Copy
Range("S76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("U76:U106").Select
Application.CutCopyMode = False
Selection.Copy
Range("V76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("X76:X106").Select
Application.CutCopyMode = False
Selection.Copy
Range("Y76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AA76:AA106").Select
Application.CutCopyMode = False
Selection.Copy
Range("AB76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AD76:AD106").Select
Application.CutCopyMode = False
Selection.Copy
Range("AE76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AG76:AG106").Select
Application.CutCopyMode = False
Selection.Copy
Range("AH76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AJ76:AJ106").Select
Application.CutCopyMode = False
Selection.Copy
Range("AK76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll ToRight:=24
Range("AM76:AM106").Select
Application.CutCopyMode = False
Selection.Copy
Range("AN76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AP76:AP106").Select
Application.CutCopyMode = False
Selection.Copy
Range("AQ76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AS76:AS106").Select
Application.CutCopyMode = False
Selection.Copy
Range("AT76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AV76:AV106").Select
Application.CutCopyMode = False
Selection.Copy
Range("AW76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AY76:AY106").Select
Application.CutCopyMode = False
Selection.Copy
Range("AZ76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("BB76:BB106").Select
Application.CutCopyMode = False
Selection.Copy
Range("BC76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("BE76:BE106").Select
Application.CutCopyMode = False
Selection.Copy
Range("BF76").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Next ws
End Sub
Last edited by a moderator: