+ Reply to Thread
Results 1 to 5 of 5

copy variable range from one sheet to top of another, rather than bottom.

Hybrid View

  1. #1
    Registered User
    Join Date
    09-07-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: copy variable range from one sheet to top of another, rather than bottom.

    Tried calculating the number of rows which works but when i add this into the macro above i get

    Object doesn't support this property or method

    any ideas?

  2. #2
    Registered User
    Join Date
    09-07-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: copy variable range from one sheet to top of another, rather than bottom.

    I've got the following macros in the attached file


    PHP Code: 
    Sub Count_rows_and_insert()

    Dim i As Integer
    endrow 
    Cells(ActiveSheet.UsedRange.Rows.Count 1ActiveCell.Column).End(xlUp).Row
    Sheets
    ("sheet2").Select
    For 1 To endrow
    Rows
    ("2:2").Select
    Selection
    .Insert shift:=xlDowncopyorigin:=xlFormatFromLeftOrAbove
    Next i
    End Sub 
    This worked once but now inserts one line when run again


    PHP Code: 
    Sub Select_Copy_Paste()
    With ActiveSheet
    .Range("C7", .Cells.SpecialCells(xlCellTypeLastCell)).Select
    End With
    Selection
    .Copy
    Sheets
    ("Sheet2").Select
    Range
    ("C3").Select
    ActiveSheet
    .Paste
    Columns
    .AutoFit
    End Sub 
    The one above again worked once but now only copies 5 rows.

    What i'd like to be able to do is combine bothe macros to do the following
    * count the number of used rows on sheet1
    * insert the number of rows on sheet2
    * select the used range on sheet1 and copy it to sheet2 where the first line was inserted.

    Can anyone please point me in the right direction/help.

    Many thanks
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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