willow1985
Well-known Member
- Joined
- Jul 24, 2019
- Messages
- 888
- Office Version
- 365
- Platform
- Windows
A part of my code below randomly gets hung up on "ActiveSheet.Paste" I am not sure why. It will give me the standard run time error and if I select debug and just proceed to run the macro it runs just fine.
It is not a consistent error but enough to get other users not experienced users using this spreadsheet to panic.
Is there a reason/way of fixing this?
Thank you
Carla
It is not a consistent error but enough to get other users not experienced users using this spreadsheet to panic.
Is there a reason/way of fixing this?
VBA Code:
Columns("X:X").Select
With Selection
.WrapText = True
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("W1").Select
If Application.CountIfs(Range("W:W"), "?*") > 1 Then
Cells.Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$W$100000").AutoFilter Field:=23, Criteria1:="<>"
LastRowColumnO = Cells(Rows.Count, 1).End(xlUp).Row
Range("W2:X" & LastRowColumnO).Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Sheets("Dashboard").Select
Range("A1").Select
ActiveSheet.Paste 'this is the line that gets hung up
Selection.ShapeRange.Name = "CC"
Selection.Name = "CC"
Selection.ShapeRange.IncrementLeft 603
Selection.ShapeRange.IncrementTop 181.5
Range("W5").Select
Sheets("CC").Select
End If
Cells.Select
Selection.AutoFilter
Range("A1").Select
Thank you
Carla