Copying formulae down a variable number of rows
Copying formulae down a variable number of rows
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Copying formulae down a variable number of rows

  1. #1
    New Member
    Join Date
    Mar 2002
    Location
    London
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    A sheet imports data into the first three columns of a blank sheet. This data always contains a different number of rows, i.e. it may be anything from 10 to 10,000.
    I now wish to copy formulae from a separate sheet, to work on the new data in cols 1-3, to the fourth column and down the required number of rows.
    How can a macro recognise how many rows to copy down?

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Ajtoo


    Try this

    Sub DoIt()
    Range("A1", Range("C65536").End(xlUp)).Copy _
    Destination:=Sheet2.Range("A1")
    End Sub


  3. #3
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    The following code counts the number of used rows in column A and sets the number to the variable NumRows:
    dim NumRows as long
    Range("A1").Select
    NumRows=Range(Selection, Selection.End(xlDown)).Count

    Hope this helps.
    Kind regards, Al.

  4. #4
    New Member
    Join Date
    Mar 2002
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    On 2002-03-15 07:56, Ajtoo wrote:
    A sheet imports data into the first three columns of a blank sheet. This data always contains a different number of rows, i.e. it may be anything from 10 to 10,000.
    I now wish to copy formulae from a separate sheet, to work on the new data in cols 1-3, to the fourth column and down the required number of rows.
    How can a macro recognise how many rows to copy down?

    Dim NumRows As Long
    NumRows = Intersect(ActiveSheet.UsedRange, Columns("A:C")).Rows.Count

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com