View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Selecting a column

Hi L,

Try replacing:

' Cut the column and place it in the Previous sheet
Selection.Cut
Sheets("Previous").Select
Range("IA1").End(xlToLeft).Select
ActiveCell.Paste


with:

ActiveCell.EntireColumn.Cut
ActiveSheet.Paste (Sheets("Previous"). _
Range("IA1").End(xlToLeft))

---
Regards,
Norman



"L.White" wrote in message
...
I am having a user select a name out of a list. Then click on the button
below. The click should then find the matching name from the sheet. Select
the entire column from the active cell down and move it to another sheet
for
archiving. I have the following so far.

Private Sub CommandButton2_Click()
' Remove Employee
Dim myEmp As String

' Match up the name and the column
myEmp = Range("L1")
Sheets("Current").Range("D4").Select
Cells.Find(What:=myEmp, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

' Select the entire column
ActiveCell.Select
ActiveCell.EntireColumn.Select

' Cut the column and place it in the Previous sheet
Selection.Cut
Sheets("Previous").Select
Range("IA1").End(xlToLeft).Select
ActiveCell.Paste

End Sub

For some reason the macro fails right after the sheet select. I have tried
a few different options on the range, but nothing is working for me. How
would one of you write this to take the cut material and paste it into the
first empty column from the left? Thanks to all of you for your help
LWhite