+ Reply to Thread
Results 1 to 5 of 5

macro copy problem

  1. #1
    JaimeTimbrell
    Guest

    macro copy problem

    Hello All,

    I am very new tomacros and VBA and I have a question relating to a copy
    problem.

    The problem I have is in automating the number of rows down with which I
    copy a range of cells.

    At present in the macro I have this bit:

    Range("T5:AC5").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("T6:T1008").Select
    ActiveSheet.Paste

    now rather than '1008' I want the 1008 bit to be a number that appears in
    cell T1 (the number is different from sheet to sheet).

    How do I do that? I have tried for quite a while to find the solution using
    a lot of excellent MVP websites, but alas the problem appears to in my
    interpretation of their help!

    Regards,
    Jaime.

  2. #2
    JE McGimpsey
    Guest

    Re: macro copy problem

    See one answer in microsoft.public.excel.programming


    Please don't post the same question in multiple newsgroups. At best, it
    tends to fragment your answers. It also tends to waste the time of those
    answering questions that have already been answered in another group.
    For tips on using these groups effectively, see

    http://cpearson.com/excel/newposte.htm




    In article <[email protected]>,
    "JaimeTimbrell" <[email protected]> wrote:

    > Hello All,
    >
    > I am very new tomacros and VBA and I have a question relating to a copy
    > problem.
    >
    > The problem I have is in automating the number of rows down with which I
    > copy a range of cells.
    >
    > At present in the macro I have this bit:
    >
    > Range("T5:AC5").Select
    > Application.CutCopyMode = False
    > Selection.Copy
    > Range("T6:T1008").Select
    > ActiveSheet.Paste
    >
    > now rather than '1008' I want the 1008 bit to be a number that appears in
    > cell T1 (the number is different from sheet to sheet).
    >
    > How do I do that? I have tried for quite a while to find the solution using
    > a lot of excellent MVP websites, but alas the problem appears to in my
    > interpretation of their help!
    >
    > Regards,
    > Jaime.


  3. #3
    flummi
    Guest

    Re: macro copy problem

    Try t organize the T1 bit in all worksheets to be in the same cell say
    A1 and try this example.

    EndRow = Range("a1").Value
    Range("T5:AC5").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("T6:T" + CStr(EndRow)).Select
    ActiveSheet.Paste


  4. #4
    JaimeTimbrell
    Guest

    Re: macro copy problem

    Thanks for your help. Sorry I didnt realise that all the sites were linked
    and that I was causing a problem.


    "JE McGimpsey" wrote:

    > See one answer in microsoft.public.excel.programming
    >
    >
    > Please don't post the same question in multiple newsgroups. At best, it
    > tends to fragment your answers. It also tends to waste the time of those
    > answering questions that have already been answered in another group.
    > For tips on using these groups effectively, see
    >
    > http://cpearson.com/excel/newposte.htm
    >
    >
    >
    >
    > In article <[email protected]>,
    > "JaimeTimbrell" <[email protected]> wrote:
    >
    > > Hello All,
    > >
    > > I am very new tomacros and VBA and I have a question relating to a copy
    > > problem.
    > >
    > > The problem I have is in automating the number of rows down with which I
    > > copy a range of cells.
    > >
    > > At present in the macro I have this bit:
    > >
    > > Range("T5:AC5").Select
    > > Application.CutCopyMode = False
    > > Selection.Copy
    > > Range("T6:T1008").Select
    > > ActiveSheet.Paste
    > >
    > > now rather than '1008' I want the 1008 bit to be a number that appears in
    > > cell T1 (the number is different from sheet to sheet).
    > >
    > > How do I do that? I have tried for quite a while to find the solution using
    > > a lot of excellent MVP websites, but alas the problem appears to in my
    > > interpretation of their help!
    > >
    > > Regards,
    > > Jaime.

    >


  5. #5
    JaimeTimbrell
    Guest

    Re: macro copy problem

    Thanks very much for your help. I will also try this approach and see which
    is the best - thanks again.

    "flummi" wrote:

    > Try t organize the T1 bit in all worksheets to be in the same cell say
    > A1 and try this example.
    >
    > EndRow = Range("a1").Value
    > Range("T5:AC5").Select
    > Application.CutCopyMode = False
    > Selection.Copy
    > Range("T6:T" + CStr(EndRow)).Select
    > ActiveSheet.Paste
    >
    >


+ 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