+ Reply to Thread
Results 1 to 6 of 6

Find and Paste

  1. #1
    Ronbo
    Guest

    Find and Paste

    I am trying to copy a range (B1..B12) from Sheet1 to a row on Sheet2. The
    row to paste to is based upon the value in Sheet1 (A1) which is 10.

    So far I have;

    Sheets("Sheet1").Select
    If Range("D15") <> Range("D17") Then
    Range("b1..b12").Select
    Selection.Copy
    Sheets("sheet2").Select

    At this point I need for it to find which row in column (A) has 10 in it and
    then go over 3 columns to C and paste.

    Thanks a lot for any help.

  2. #2
    Jim Thomlinson
    Guest

    RE: Find and Paste

    Give this a try...

    Dim rngFound As Range

    Set rngFound = Sheets("Sheet2").Columns("A").Find(What:=10, _
    LookAt:=xlWhole, _
    LookIn:=xlValues)
    If rngFound Is Nothing Then
    MsgBox "Sorry. Not found..."
    Else
    With Sheets("Sheet1")
    If .Range("D15") <> .Range("D17") Then _
    .Range("B1:B12").Copy rngFound.Offset(0, 3)
    End With
    End If
    --
    HTH...

    Jim Thomlinson


    "Ronbo" wrote:

    > I am trying to copy a range (B1..B12) from Sheet1 to a row on Sheet2. The
    > row to paste to is based upon the value in Sheet1 (A1) which is 10.
    >
    > So far I have;
    >
    > Sheets("Sheet1").Select
    > If Range("D15") <> Range("D17") Then
    > Range("b1..b12").Select
    > Selection.Copy
    > Sheets("sheet2").Select
    >
    > At this point I need for it to find which row in column (A) has 10 in it and
    > then go over 3 columns to C and paste.
    >
    > Thanks a lot for any help.


  3. #3
    Ronbo
    Guest

    RE: Find and Paste

    Thanks Jim for the help. Its exactly what I am looking for. For some reason
    it was putting the data in row 11, but by changing the offset to -1 it puts
    it in the correct row.

    Also, I need to change the What:=10 to What:=Sheet1!A1. What is the correct
    syntax for such?





    "Jim Thomlinson" wrote:

    > Give this a try...
    >
    > Dim rngFound As Range
    >
    > Set rngFound = Sheets("Sheet2").Columns("A").Find(What:=10, _
    > LookAt:=xlWhole, _
    > LookIn:=xlValues)
    > If rngFound Is Nothing Then
    > MsgBox "Sorry. Not found..."
    > Else
    > With Sheets("Sheet1")
    > If .Range("D15") <> .Range("D17") Then _
    > .Range("B1:B12").Copy rngFound.Offset(0, 3)
    > End With
    > End If
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "Ronbo" wrote:
    >
    > > I am trying to copy a range (B1..B12) from Sheet1 to a row on Sheet2. The
    > > row to paste to is based upon the value in Sheet1 (A1) which is 10.
    > >
    > > So far I have;
    > >
    > > Sheets("Sheet1").Select
    > > If Range("D15") <> Range("D17") Then
    > > Range("b1..b12").Select
    > > Selection.Copy
    > > Sheets("sheet2").Select
    > >
    > > At this point I need for it to find which row in column (A) has 10 in it and
    > > then go over 3 columns to C and paste.
    > >
    > > Thanks a lot for any help.


  4. #4
    Ronbo
    Guest

    RE: Find and Paste

    Also, how can I get it to paste values? It is pasting formulas.
    again Thanks

    "Ronbo" wrote:

    > Thanks Jim for the help. Its exactly what I am looking for. For some reason
    > it was putting the data in row 11, but by changing the offset to -1 it puts
    > it in the correct row.
    >
    > Also, I need to change the What:=10 to What:=Sheet1!A1. What is the correct
    > syntax for such?
    >
    >
    >
    >
    >
    > "Jim Thomlinson" wrote:
    >
    > > Give this a try...
    > >
    > > Dim rngFound As Range
    > >
    > > Set rngFound = Sheets("Sheet2").Columns("A").Find(What:=10, _
    > > LookAt:=xlWhole, _
    > > LookIn:=xlValues)
    > > If rngFound Is Nothing Then
    > > MsgBox "Sorry. Not found..."
    > > Else
    > > With Sheets("Sheet1")
    > > If .Range("D15") <> .Range("D17") Then _
    > > .Range("B1:B12").Copy rngFound.Offset(0, 3)
    > > End With
    > > End If
    > > --
    > > HTH...
    > >
    > > Jim Thomlinson
    > >
    > >
    > > "Ronbo" wrote:
    > >
    > > > I am trying to copy a range (B1..B12) from Sheet1 to a row on Sheet2. The
    > > > row to paste to is based upon the value in Sheet1 (A1) which is 10.
    > > >
    > > > So far I have;
    > > >
    > > > Sheets("Sheet1").Select
    > > > If Range("D15") <> Range("D17") Then
    > > > Range("b1..b12").Select
    > > > Selection.Copy
    > > > Sheets("sheet2").Select
    > > >
    > > > At this point I need for it to find which row in column (A) has 10 in it and
    > > > then go over 3 columns to C and paste.
    > > >
    > > > Thanks a lot for any help.


  5. #5
    Jim Thomlinson
    Guest

    RE: Find and Paste

    Dim rngFound As Range

    Set rngFound =
    Sheets("Sheet2").Columns("A").Find(What:=Sheets("Sheet1").Range("A1").Value, _
    LookAt:=xlWhole, _
    LookIn:=xlValues)
    If rngFound Is Nothing Then
    MsgBox "Sorry. Not found..."
    Else
    With Sheets("Sheet1")
    If .Range("D15") <> .Range("D17") Then _
    .Range("B1:B12").Copy
    rngFound.Offset(0, 3).PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    End With
    End If
    --
    HTH...

    Jim Thomlinson


    "Ronbo" wrote:

    > Also, how can I get it to paste values? It is pasting formulas.
    > again Thanks
    >
    > "Ronbo" wrote:
    >
    > > Thanks Jim for the help. Its exactly what I am looking for. For some reason
    > > it was putting the data in row 11, but by changing the offset to -1 it puts
    > > it in the correct row.
    > >
    > > Also, I need to change the What:=10 to What:=Sheet1!A1. What is the correct
    > > syntax for such?
    > >
    > >
    > >
    > >
    > >
    > > "Jim Thomlinson" wrote:
    > >
    > > > Give this a try...
    > > >
    > > > Dim rngFound As Range
    > > >
    > > > Set rngFound = Sheets("Sheet2").Columns("A").Find(What:=10, _
    > > > LookAt:=xlWhole, _
    > > > LookIn:=xlValues)
    > > > If rngFound Is Nothing Then
    > > > MsgBox "Sorry. Not found..."
    > > > Else
    > > > With Sheets("Sheet1")
    > > > If .Range("D15") <> .Range("D17") Then _
    > > > .Range("B1:B12").Copy rngFound.Offset(0, 3)
    > > > End With
    > > > End If
    > > > --
    > > > HTH...
    > > >
    > > > Jim Thomlinson
    > > >
    > > >
    > > > "Ronbo" wrote:
    > > >
    > > > > I am trying to copy a range (B1..B12) from Sheet1 to a row on Sheet2. The
    > > > > row to paste to is based upon the value in Sheet1 (A1) which is 10.
    > > > >
    > > > > So far I have;
    > > > >
    > > > > Sheets("Sheet1").Select
    > > > > If Range("D15") <> Range("D17") Then
    > > > > Range("b1..b12").Select
    > > > > Selection.Copy
    > > > > Sheets("sheet2").Select
    > > > >
    > > > > At this point I need for it to find which row in column (A) has 10 in it and
    > > > > then go over 3 columns to C and paste.
    > > > >
    > > > > Thanks a lot for any help.


  6. #6
    Ronbo
    Guest

    RE: Find and Paste

    Thanks A LOT for your time and expertise. Its PERFECT.



    "Jim Thomlinson" wrote:

    > Dim rngFound As Range
    >
    > Set rngFound =
    > Sheets("Sheet2").Columns("A").Find(What:=Sheets("Sheet1").Range("A1").Value, _
    > LookAt:=xlWhole, _
    > LookIn:=xlValues)
    > If rngFound Is Nothing Then
    > MsgBox "Sorry. Not found..."
    > Else
    > With Sheets("Sheet1")
    > If .Range("D15") <> .Range("D17") Then _
    > .Range("B1:B12").Copy
    > rngFound.Offset(0, 3).PasteSpecial xlPasteValues
    > Application.CutCopyMode = False
    > End With
    > End If
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "Ronbo" wrote:
    >
    > > Also, how can I get it to paste values? It is pasting formulas.
    > > again Thanks
    > >
    > > "Ronbo" wrote:
    > >
    > > > Thanks Jim for the help. Its exactly what I am looking for. For some reason
    > > > it was putting the data in row 11, but by changing the offset to -1 it puts
    > > > it in the correct row.
    > > >
    > > > Also, I need to change the What:=10 to What:=Sheet1!A1. What is the correct
    > > > syntax for such?
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > "Jim Thomlinson" wrote:
    > > >
    > > > > Give this a try...
    > > > >
    > > > > Dim rngFound As Range
    > > > >
    > > > > Set rngFound = Sheets("Sheet2").Columns("A").Find(What:=10, _
    > > > > LookAt:=xlWhole, _
    > > > > LookIn:=xlValues)
    > > > > If rngFound Is Nothing Then
    > > > > MsgBox "Sorry. Not found..."
    > > > > Else
    > > > > With Sheets("Sheet1")
    > > > > If .Range("D15") <> .Range("D17") Then _
    > > > > .Range("B1:B12").Copy rngFound.Offset(0, 3)
    > > > > End With
    > > > > End If
    > > > > --
    > > > > HTH...
    > > > >
    > > > > Jim Thomlinson
    > > > >
    > > > >
    > > > > "Ronbo" wrote:
    > > > >
    > > > > > I am trying to copy a range (B1..B12) from Sheet1 to a row on Sheet2. The
    > > > > > row to paste to is based upon the value in Sheet1 (A1) which is 10.
    > > > > >
    > > > > > So far I have;
    > > > > >
    > > > > > Sheets("Sheet1").Select
    > > > > > If Range("D15") <> Range("D17") Then
    > > > > > Range("b1..b12").Select
    > > > > > Selection.Copy
    > > > > > Sheets("sheet2").Select
    > > > > >
    > > > > > At this point I need for it to find which row in column (A) has 10 in it and
    > > > > > then go over 3 columns to C and paste.
    > > > > >
    > > > > > Thanks a lot for any help.


+ 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