Results 1 to 3 of 3

Create Macro to link to Command Button and move information from one sheet to another

Threaded View

  1. #1
    Registered User
    Join Date
    08-21-2018
    Location
    SLC
    MS-Off Ver
    Microsoft Office 365 2016
    Posts
    2

    Question Create Macro to link to Command Button and move information from one sheet to another

    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
    Last edited by alansidman; 08-22-2018 at 03:16 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro exporting and saving the wrong page with wrong name
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2018, 01:24 PM
  2. [SOLVED] Wrong formula or wrong function?
    By cpope in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-08-2017, 10:27 AM
  3. wrong macro? doing something wrong?
    By weatherguard in forum Excel General
    Replies: 1
    Last Post: 03-04-2016, 06:30 PM
  4. Wrong coding or RANDBETWEEN is wrong?
    By zbor in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-31-2013, 10:01 AM
  5. wHAT AM i DOING wrong
    By DMB in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-27-2005, 01:41 PM
  6. What is wrong with this?
    By Conan Kelly in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-08-2005, 10:30 PM
  7. What am I doing wrong?
    By jewels in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-08-2005, 10:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1