+ Reply to Thread
Results 1 to 5 of 5

Moving data from sheet 2 to sheet 1

Hybrid View

Skiman Moving data from sheet 2 to... 08-20-2009, 12:40 PM
Palmetto Re: Moving data from sheet 2... 08-20-2009, 01:32 PM
Skiman Re: Moving data from sheet 2... 08-20-2009, 01:51 PM
Palmetto Re: Moving data from sheet 2... 08-20-2009, 02:43 PM
Skiman Re: Moving data from sheet 2... 08-20-2009, 02:53 PM
  1. #1
    Registered User
    Join Date
    03-08-2005
    Posts
    55

    Moving data from sheet 2 to sheet 1

    Hello all,

    Is there a way to click on a cell from sheet 2 and have its data transfer over to a specific on sheet 1?

    Thanks in advance.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Moving data from sheet 2 to sheet 1

    You would need to use VBA to do this.
    Something along the lines of:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
        If Not Intersect(Target, Range("A1")) Is Nothing And _
            Target.Value <> vbNullString Then
            Sheet1.Range("A1") = Target.Value
        End If
    
    End Sub
    Where, when you select cell A1 on sheet2, the code makes cell A1 on sheet1 contain the same value.

    The above code would need to go in the sheet module for sheet2.

  3. #3
    Registered User
    Join Date
    03-08-2005
    Posts
    55

    Re: Moving data from sheet 2 to sheet 1

    Thanks for the reply.

    Would it work the same way if I wanted A2 on sheet 2 to go to A1 on sheet 1 and then I wanted A9 on sheet 2 to go to A2 on sheet 1? Basically random selections on sheet two to populate the cells on sheet 1 in a certain order?

    Thanks again-

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Moving data from sheet 2 to sheet 1

    Basically random selections on sheet two to populate the cells on sheet 1 in a certain order?
    This code will place the value of any cell selected on sheet2 into the first empty cell in column-A on sheet 1. Is this what you mean?
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
        Dim lrow As Long
        
        lrow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
        lrow = lrow + 1
        
        Sheet1.Cells(lrow, 1).Value = Target.Value
    
    End Sub

  5. #5
    Registered User
    Join Date
    03-08-2005
    Posts
    55

    Re: Moving data from sheet 2 to sheet 1

    Correct. Always starting in sheet 2, cells chosen would populate sheet 1. The order would be a1,a2,a3,etc.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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