Solved

VBA excel copy code causing excel to crash

Posted on 2016-10-21
3
43 Views
Last Modified: 2016-10-21
Could anyone explain firstly why this code is causing excel to crash ? is it simple because the computer is so old.

Sub CopyRow()
Dim sws As Worksheet, dws As Worksheet
Dim lr As Long
Application.EnableEvents = False
Application.ScreenUpdating = False
Set sws = Sheets("Blueteq")
Set dws = Sheets("Sheet2")
lr = sws.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
With sws.Range("AB5:AB" & lr)
   .AutoFilter field:=1, Criteria1:="True"
   If .SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
      sws.Range("AB6:AB" & lr).SpecialCells(xlCellTypeVisible).EntireRow.Copy dws.Range("A" & Rows.Count).End(3)(2)
      sws.Range("AB6:AB" & lr).SpecialCells(xlCellTypeVisible).EntireRow.Delete
   End If
   .AutoFilter
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub


also it is causing a slight graphical glitch in Excel so the lines not match up in one row any more as you can see in the screen shot.
screensheet-of-spreadsheet.png
0
Comment
Question by:Sam Coombes
  • 2
3 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 41854066
After we modified your code in this previous question did it ever work? If so what changes did you make after that? Also please attach your workbook so I can see if it works OK when I use it. Also please list the steps that wind up with it crashing.
1
 

Author Comment

by:Sam Coombes
ID: 41854373
Yep great thank you very much
0
 

Author Closing Comment

by:Sam Coombes
ID: 41854375
Once again thank you very much
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Remove duplicates using cell values VBA 2 28
Access Open Report with SQL Parameter 11 28
Excel VBA 4 25
Excel filter on tab not showing any entries? 5 16
This article will show you how to use shortcut menus in the Access run-time environment.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now