+ Reply to Thread
Results 1 to 10 of 10

Copy a Range from sheet and paste the next blank line in another s

Hybrid View

  1. #1
    ca1358
    Guest

    Copy a Range from sheet and paste the next blank line in another s

    I have 2 worksheets
    One is Named “GN15”
    Two is Named “TempTable”
    On Sheet “GN15” - I need to simply click a command button in cell W28 and
    copy A28:V28 and then
    Go To Sheet “TempTable” and paste to the first blank row available.


    I tried several scenarios and nothing work and I am running out time on this
    project.

    Any help would greatly be appreciated.

    Private Sub cmdGN15Data1_Click()

    Range("A28:v28").Copy
    Worksheets("TempTable").Activate


    End Sub

    --
    ca1358

  2. #2
    Jim Thomlinson
    Guest

    RE: Copy a Range from sheet and paste the next blank line in another s

    Give this a try...

    Private Sub cmdGN15Data1_Click()
    dim rngToCopy as range
    dim rngToPaste as range

    set rngToCopy = sheets("GN15").Range("A28:v28")
    set rngToPaste = sheets("TempTable").cells(rows.count,
    "A").end(xlUp).offset(1,0)

    rngToCopy.copy rngtopaste


    End Sub
    --
    HTH...

    Jim Thomlinson


    "ca1358" wrote:

    > I have 2 worksheets
    > One is Named “GN15”
    > Two is Named “TempTable”
    > On Sheet “GN15” - I need to simply click a command button in cell W28 and
    > copy A28:V28 and then
    > Go To Sheet “TempTable” and paste to the first blank row available.
    >
    >
    > I tried several scenarios and nothing work and I am running out time on this
    > project.
    >
    > Any help would greatly be appreciated.
    >
    > Private Sub cmdGN15Data1_Click()
    >
    > Range("A28:v28").Copy
    > Worksheets("TempTable").Activate
    >
    >
    > End Sub
    >
    > --
    > ca1358


  3. #3
    ca1358
    Guest

    RE: Copy a Range from sheet and paste the next blank line in anoth

    This works. One more question? How do you paste special values?
    --
    ca1358


    "Jim Thomlinson" wrote:

    > Give this a try...
    >
    > Private Sub cmdGN15Data1_Click()
    > dim rngToCopy as range
    > dim rngToPaste as range
    >
    > set rngToCopy = sheets("GN15").Range("A28:v28")
    > set rngToPaste = sheets("TempTable").cells(rows.count,
    > "A").end(xlUp).offset(1,0)
    >
    > rngToCopy.copy rngtopaste
    >
    >
    > End Sub
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "ca1358" wrote:
    >
    > > I have 2 worksheets
    > > One is Named “GN15”
    > > Two is Named “TempTable”
    > > On Sheet “GN15” - I need to simply click a command button in cell W28 and
    > > copy A28:V28 and then
    > > Go To Sheet “TempTable” and paste to the first blank row available.
    > >
    > >
    > > I tried several scenarios and nothing work and I am running out time on this
    > > project.
    > >
    > > Any help would greatly be appreciated.
    > >
    > > Private Sub cmdGN15Data1_Click()
    > >
    > > Range("A28:v28").Copy
    > > Worksheets("TempTable").Activate
    > >
    > >
    > > End Sub
    > >
    > > --
    > > ca1358


  4. #4
    Jim Thomlinson
    Guest

    RE: Copy a Range from sheet and paste the next blank line in anoth

    Private Sub cmdGN15Data1_Click()
    Dim rngToCopy As Range
    Dim rngToPaste As Range

    Set rngToCopy = Sheets("GN15").Range("A28:v28")
    Set rngToPaste = Sheets("TempTable").Cells(Rows.Count, _
    "A").End(xlUp).Offset(1, 0)

    rngToCopy.Copy
    rngToPaste.PasteSpecial xlPasteValues

    End Sub

    --
    HTH...

    Jim Thomlinson


    "ca1358" wrote:

    > This works. One more question? How do you paste special values?
    > --
    > ca1358
    >
    >
    > "Jim Thomlinson" wrote:
    >
    > > Give this a try...
    > >
    > > Private Sub cmdGN15Data1_Click()
    > > dim rngToCopy as range
    > > dim rngToPaste as range
    > >
    > > set rngToCopy = sheets("GN15").Range("A28:v28")
    > > set rngToPaste = sheets("TempTable").cells(rows.count,
    > > "A").end(xlUp).offset(1,0)
    > >
    > > rngToCopy.copy rngtopaste
    > >
    > >
    > > End Sub
    > > --
    > > HTH...
    > >
    > > Jim Thomlinson
    > >
    > >
    > > "ca1358" wrote:
    > >
    > > > I have 2 worksheets
    > > > One is Named “GN15”
    > > > Two is Named “TempTable”
    > > > On Sheet “GN15” - I need to simply click a command button in cell W28 and
    > > > copy A28:V28 and then
    > > > Go To Sheet “TempTable” and paste to the first blank row available.
    > > >
    > > >
    > > > I tried several scenarios and nothing work and I am running out time on this
    > > > project.
    > > >
    > > > Any help would greatly be appreciated.
    > > >
    > > > Private Sub cmdGN15Data1_Click()
    > > >
    > > > Range("A28:v28").Copy
    > > > Worksheets("TempTable").Activate
    > > >
    > > >
    > > > End Sub
    > > >
    > > > --
    > > > ca1358


  5. #5
    ca1358
    Guest

    RE: Copy a Range from sheet and paste the next blank line in anoth

    --
    I rec'd run-time error "1004"
    PasteSpecial method of Range class failed.

    Any suggestions.

    Thank you for the first part, beening trying for day just to get that part
    to work.


    ca1358


    "Jim Thomlinson" wrote:

    > Private Sub cmdGN15Data1_Click()
    > Dim rngToCopy As Range
    > Dim rngToPaste As Range
    >
    > Set rngToCopy = Sheets("GN15").Range("A28:v28")
    > Set rngToPaste = Sheets("TempTable").Cells(Rows.Count, _
    > "A").End(xlUp).Offset(1, 0)
    >
    > rngToCopy.Copy
    > rngToPaste.PasteSpecial xlPasteValues
    >
    > End Sub
    >
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "ca1358" wrote:
    >
    > > This works. One more question? How do you paste special values?
    > > --
    > > ca1358
    > >
    > >
    > > "Jim Thomlinson" wrote:
    > >
    > > > Give this a try...
    > > >
    > > > Private Sub cmdGN15Data1_Click()
    > > > dim rngToCopy as range
    > > > dim rngToPaste as range
    > > >
    > > > set rngToCopy = sheets("GN15").Range("A28:v28")
    > > > set rngToPaste = sheets("TempTable").cells(rows.count,
    > > > "A").end(xlUp).offset(1,0)
    > > >
    > > > rngToCopy.copy rngtopaste
    > > >
    > > >
    > > > End Sub
    > > > --
    > > > HTH...
    > > >
    > > > Jim Thomlinson
    > > >
    > > >
    > > > "ca1358" wrote:
    > > >
    > > > > I have 2 worksheets
    > > > > One is Named “GN15”
    > > > > Two is Named “TempTable”
    > > > > On Sheet “GN15” - I need to simply click a command button in cell W28 and
    > > > > copy A28:V28 and then
    > > > > Go To Sheet “TempTable” and paste to the first blank row available.
    > > > >
    > > > >
    > > > > I tried several scenarios and nothing work and I am running out time on this
    > > > > project.
    > > > >
    > > > > Any help would greatly be appreciated.
    > > > >
    > > > > Private Sub cmdGN15Data1_Click()
    > > > >
    > > > > Range("A28:v28").Copy
    > > > > Worksheets("TempTable").Activate
    > > > >
    > > > >
    > > > > End Sub
    > > > >
    > > > > --
    > > > > ca1358


  6. #6
    Jim Thomlinson
    Guest

    RE: Copy a Range from sheet and paste the next blank line in anoth

    That code works for me. My best guess is that your worksheet TempTable is
    protected. If so then try this

    Private Sub cmdGN15Data1_Click()
    Dim rngToCopy As Range
    Dim rngToPaste As Range
    Dim wksToPaste as worksheet

    Set rngToCopy = Sheets("GN15").Range("A28:v28")
    Set wksToPaste = Sheets("TempTable")
    Set rngToPaste = wksToPaste.Cells(Rows.Count, _
    "A").End(xlUp).Offset(1, 0)

    rngToCopy.Copy
    wksToPaste.Unprotect "your password"
    rngToPaste.PasteSpecial xlPasteValues
    wksToPaste.Protect "your password"

    Application.CutCopyMode = False
    End Sub

    --
    HTH...

    Jim Thomlinson


    "ca1358" wrote:

    > --
    > I rec'd run-time error "1004"
    > PasteSpecial method of Range class failed.
    >
    > Any suggestions.
    >
    > Thank you for the first part, beening trying for day just to get that part
    > to work.
    >
    >
    > ca1358
    >
    >
    > "Jim Thomlinson" wrote:
    >
    > > Private Sub cmdGN15Data1_Click()
    > > Dim rngToCopy As Range
    > > Dim rngToPaste As Range
    > >
    > > Set rngToCopy = Sheets("GN15").Range("A28:v28")
    > > Set rngToPaste = Sheets("TempTable").Cells(Rows.Count, _
    > > "A").End(xlUp).Offset(1, 0)
    > >
    > > rngToCopy.Copy
    > > rngToPaste.PasteSpecial xlPasteValues
    > >
    > > End Sub
    > >
    > > --
    > > HTH...
    > >
    > > Jim Thomlinson
    > >
    > >
    > > "ca1358" wrote:
    > >
    > > > This works. One more question? How do you paste special values?
    > > > --
    > > > ca1358
    > > >
    > > >
    > > > "Jim Thomlinson" wrote:
    > > >
    > > > > Give this a try...
    > > > >
    > > > > Private Sub cmdGN15Data1_Click()
    > > > > dim rngToCopy as range
    > > > > dim rngToPaste as range
    > > > >
    > > > > set rngToCopy = sheets("GN15").Range("A28:v28")
    > > > > set rngToPaste = sheets("TempTable").cells(rows.count,
    > > > > "A").end(xlUp).offset(1,0)
    > > > >
    > > > > rngToCopy.copy rngtopaste
    > > > >
    > > > >
    > > > > End Sub
    > > > > --
    > > > > HTH...
    > > > >
    > > > > Jim Thomlinson
    > > > >
    > > > >
    > > > > "ca1358" wrote:
    > > > >
    > > > > > I have 2 worksheets
    > > > > > One is Named “GN15”
    > > > > > Two is Named “TempTable”
    > > > > > On Sheet “GN15” - I need to simply click a command button in cell W28 and
    > > > > > copy A28:V28 and then
    > > > > > Go To Sheet “TempTable” and paste to the first blank row available.
    > > > > >
    > > > > >
    > > > > > I tried several scenarios and nothing work and I am running out time on this
    > > > > > project.
    > > > > >
    > > > > > Any help would greatly be appreciated.
    > > > > >
    > > > > > Private Sub cmdGN15Data1_Click()
    > > > > >
    > > > > > Range("A28:v28").Copy
    > > > > > Worksheets("TempTable").Activate
    > > > > >
    > > > > >
    > > > > > End Sub
    > > > > >
    > > > > > --
    > > > > > ca1358


  7. #7
    sebastienm
    Guest

    RE: Copy a Range from sheet and paste the next blank line in another s

    Hi,
    Try:

    Private Sub cmdGN15Data1_Click()
    Dim rgDest As Range ' destination range

    Range("A28:v28").Copy

    'determine last cell:
    Set rgDest = Worksheets("TempTable").Range("A1")
    Set rgDest = rgDest.EntireColumn.Cells(rgDest.EntireColumn.Cells.Count)
    Set rgDest = rgDest.End(xlUp).Offset(1, 0)

    'copy/paste
    Range("A28:v28").Copy rgDest

    End Sub
    --
    Regards,
    Sébastien
    <http://www.ondemandanalysis.com>


    "ca1358" wrote:

    > I have 2 worksheets
    > One is Named “GN15”
    > Two is Named “TempTable”
    > On Sheet “GN15” - I need to simply click a command button in cell W28 and
    > copy A28:V28 and then
    > Go To Sheet “TempTable” and paste to the first blank row available.
    >
    >
    > I tried several scenarios and nothing work and I am running out time on this
    > project.
    >
    > Any help would greatly be appreciated.
    >
    > Private Sub cmdGN15Data1_Click()
    >
    > Range("A28:v28").Copy
    > Worksheets("TempTable").Activate
    >
    >
    > End Sub
    >
    > --
    > ca1358


  8. #8
    ca1358
    Guest

    RE: Copy a Range from sheet and paste the next blank line in anoth

    This works. One more question - how do you paste special values?
    --
    ca1358


    "sebastienm" wrote:

    > Hi,
    > Try:
    >
    > Private Sub cmdGN15Data1_Click()
    > Dim rgDest As Range ' destination range
    >
    > Range("A28:v28").Copy
    >
    > 'determine last cell:
    > Set rgDest = Worksheets("TempTable").Range("A1")
    > Set rgDest = rgDest.EntireColumn.Cells(rgDest.EntireColumn.Cells.Count)
    > Set rgDest = rgDest.End(xlUp).Offset(1, 0)
    >
    > 'copy/paste
    > Range("A28:v28").Copy rgDest
    >
    > End Sub
    > --
    > Regards,
    > Sébastien
    > <http://www.ondemandanalysis.com>
    >
    >
    > "ca1358" wrote:
    >
    > > I have 2 worksheets
    > > One is Named “GN15”
    > > Two is Named “TempTable”
    > > On Sheet “GN15” - I need to simply click a command button in cell W28 and
    > > copy A28:V28 and then
    > > Go To Sheet “TempTable” and paste to the first blank row available.
    > >
    > >
    > > I tried several scenarios and nothing work and I am running out time on this
    > > project.
    > >
    > > Any help would greatly be appreciated.
    > >
    > > Private Sub cmdGN15Data1_Click()
    > >
    > > Range("A28:v28").Copy
    > > Worksheets("TempTable").Activate
    > >
    > >
    > > End Sub
    > >
    > > --
    > > ca1358


+ 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