I am trying to create a Macro that links to a Command Button in Excel. I used this code because I want to transfer information from one sheet to another while deleting the cell from the the first sheet. Lastly, creating a command button with a Macro would make this process easier because I want to be able to click that button and have the documents that are marked as "Archieved" move over automatically to the second sheet and delete the cell from the first sheet. When I tried using this code, I was unable to get a result at all. Nothing would happen. I am wondering if my code is incorrect or if I messed up some of the ranges.
Private Sub CommandButton1_Click()
Dim ClientName As String, Diagnosis As String
Worksheets("sheet1").Select
ClientName = Range("J3")
Diagnosis = Range("K3")
Worksheets("sheet2").Select
Worksheets("sheet2").Range("A1").Select
If Worksheets("sheet2").Range("J3").Offset(1, 0) <> "" Then
Worksheets("sheet7").Range("J3").End(xlDown).Select
End If
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = ClientName
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Diagnosis
Worksheets("sheet1").Select
Worksheets("sheet1").Range("A2:B2").ClearContents
End Sub
Bookmarks