Jumat, 08 April 2016

RE: [ExcelVBA] Code that needs help

 

Bob,

Thanks for your help previously. I've been trying to tweak this code in a way so that a cell that fits a specific criteria will be cut and pasted into a new location. I tried several different commands and combination of commands but I get an error saying the command I chose cannot be performed with multiple selections. I am obviously not an experienced coder. I tried the changes highlighted in yellow below. Do you have any feedback that might help?

 

Dim rng As Range
Dim lastrow As Long

Application.ScreenUpdating = False

With ActiveSheet

 

lastrow = .Cells(.Rows.Count, "C").End(xlUp).Row

Set rng = .Range("C1").Resize(lastrow)

rng.AutoFilter Field:=1, Criteria1:="=20", Operator:=xlOr, Criteria2:="=33"

On Error Resume Next

Set rng = rng.Offset(1).SpecialCells(xlCellTypeVisible)

On Error GoTo 0

If Not rng Is Nothing Then rng.cells.cut

rng.Offset(, 1).Paste

.Range("C1").AutoFilter

   

End With

Application.ScreenUpdating = True

End Sub


 

__._,_.___

Posted by: mgarza@fellowes.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? The Yahoo Mail app is fast, beautiful and intuitive. Try it today!

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Poskan Komentar