+ Reply to Thread
Results 1 to 6 of 6

problem pasting a range

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,671

    problem pasting a range

    Hi,

    I am copying a range using the following code

    Workbooks(Gradebook_Filename).Worksheets(Gradebook_Sht_Nm_Quiz).Range(alphacol(Start_insert_Col) & 1 & ":" & alphacol(End_insert_col) & 1).Copy

    One of the cols that i am copying has the left and right borders activated ALL down the column.

    When i paste the data for some reason the col in my original data that has the left/right border ALL the way down the col .........this also gets pasted so for example. if say col X has the left/right border all the way down the column ........i copy the data.........then paste........the left/right border ALL the way down the column also gets pasted. I do want to keep the border in the cell that has it but i dont want it to pasted the left/right border all the way down the col.

    I hope i made sense.

  2. #2
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,671

    Re: problem pasting a range

    Problem has gone away.......not sure why exactly. But i re-loaded something and now the problem is gone........very strange.

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,671

    Re: problem pasting a range

    I found what the problem was....not sure i understand why but here it is:

    When i use this code (see below) the left /right borders from the entire col (all the way down) are also copied to the new location

    Workbooks(Gradebook_Filename).Worksheets(Gradebook_Sht_Nm_Quiz).Range(alphacol(Start_insert_Col) & 1 & ":" & alphacol(End_insert_col) & 1).Copy

    But when i use this one..........only the left / right borders in the cell are copied and transferred over

    Workbooks(Gradebook_Filename).Worksheets(Gradebook_Sht_Nm_Quiz).Range(alphacol(Start_insert_Col) & "1:" & alphacol(End_insert_col) & "1").Copy

  4. #4
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,671

    Re: problem pasting a range

    ok......update again.

    Turns out if i use this code the first time........it works fine. If i then delete what i just pasted and run the macro again........i get the left/right borders all the way down the col

    Workbooks(Gradebook_Filename).Worksheets(Gradebook_Sht_Nm_Quiz).Range(alphacol(Start_insert_Col) & "1:" & alphacol(End_insert_col) & "1").Copy

  5. #5
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,671

    Re: problem pasting a range

    ok...i think i figured it out.......i was trying lots of things and one of the things i tried i think as this

    Workbooks(Gradebook_Filename).Worksheets(Gradebook_Sht_Nm_FormTemp).Range(alphacol(Start_insert_Col) & quiz_template_header_row & ":" _
        & alphacol(End_insert_col) & quiz_template_header_row).Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    notice the "copyorigin:=xlFormatFromLeftorAbove

    I think this was copying the left/right borders down the col from the source location.

  6. #6
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,671

    Re: problem pasting a range

    yep that was it........just verified it.

+ 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