Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Wayne Crawford   on Jan 01 In MS Office Category.

  
Question Answered By: Catherine Campbell   on Jan 01

I recorded a macro that copied 3 columns that I needed from the
checklist sheet  ("Sheet1"), went to another sheet ("Sheet2"), Paste/
Special/Value the copied cells to Sheet2 then sorted them so the
FALSE rows that I did an If formula to show blank if FALSE would sort
to the bottom of the list. This worked fine in the macro but when I
copied the macro code to the Command Button that I wanted it to run
from I get: Run Time Error '1004' Method 'Range'
of 'object_Worksheet' Failed

Here is the code in VBA:

Private Sub CommandButton1_Click()
Range("D4:F23").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks
:=False, Transpose:=False
Range("A2:C21").Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range
("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
End Sub

It stops at: Range("D4:F23").Select

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on List in one sheet unanswered questions in checklist sheet Or get search suggestion and latest updates.


Tagged: