View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pappaz pappaz is offline
external usenet poster
 
Posts: 5
Default programming a button

I created a macro that will select specific columns on different sheets and
sort them, and it works fine. I want to create a command button that will do
the same thing, I copied the code from the macro and put into the button and
I get an error when it tries to select the columns. What do I need to change
to make this work? here is the code I have

Columns("A:E").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1").Select