+ Reply to Thread
Results 1 to 2 of 2

Copy value and paste in cell using changing match value

  1. #1
    Registered User
    Join Date
    11-29-2010
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    2

    Copy value and paste in cell using changing match value

    I am basically trying to do the following:

    Copy a value from H13 on one worksheet (User Interface) and paste the value on another worksheet (Customer) in cell "Ox", the O is column (letter) O and x is the index value I am grabbing from cell U1.

    Reason I am trying this is to allow for the row number to change according to the value they select on another sheet.

    I have been getting Error 400

    Any suggestions?

    I have tried the following.


    Sub UpdateValues()
    Dim offs As Byte
    offs = Range("Customers!U1").Value
    Range("H13").Select
    Set MyRange = Selection
    MyRange.Copy
    Sheets("Customers").Activate
    Application.Goto ActiveWorkbook.Sheets("Customers").Cells(1, 15).Offset(offs, 0)
    End Sub

    OR

    Sub UpdateValues()
    Dim ColVar As Integer
    ColVar = Cells(1, 21).Value
    Range("H13").Select
    Set MyRange = Selection
    MyRange.Copy
    Sheets("Customers").Activate
    Application.Goto ActiveWorkbook.Sheets("Customers").Cells(ColVar, 15)
    End Sub

    Sheets("User Interface").Activate
    If Range("AA6").Text = "TRUE" Then
    Range("H13").Select
    Selection.Copy
    Sheets("Customers").Activate
    Range("Customers!O1").Offset(Range("'user interface'!u1").Value - 1).Paste
    Else
    Range("E19").Select
    End If
    End Sub

  2. #2
    Registered User
    Join Date
    11-29-2010
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Copy value and paste in cell using changing match value

    I figured it out. See below


    Sub UpdateValues()
    Dim ColVar As Integer
    ColVar = Cells(1, 21).Value
    Range("H13").Select
    Set MyRange = Selection
    MyRange.Copy
    Sheets("Customers").Activate
    Application.Goto ActiveWorkbook.Sheets("Customers").Range("O1").Offset(ColVar, 0)
    ActiveCell.PasteSpecial (xlPasteValues)
    End Sub

+ 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