+ Reply to Thread
Results 1 to 5 of 5

Range Select Macro

  1. #1
    Registered User
    Join Date
    01-25-2006
    Posts
    2

    Range Select Macro

    I recorded the macro below.

    I need a macro that will copy a group of cells. I select the first cell, say A11, and the macro takes over, selecting A11:N11 and copying the selection to A2 on Sheet3.
    The problem with the macro is, it always selects A11:N11. I need it to start where I choose, say, A17, then it selects A17:N17

    Range("A11:N11").Select
    Selection.Copy
    Sheets("Macro").Select
    Range("A2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Sheets("Form").Select
    End Sub

    Thanks in advance

  2. #2
    Bill Kuunders
    Guest

    Re: Range Select Macro

    Range(ActiveCell, ActiveCell.Offset(0, 13)).Select

    should do the trick

    Greetings from New Zealand
    Bill K
    "Archie" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I recorded the macro below.
    >
    > I need a macro that will copy a group of cells. I select the first
    > cell, say A11, and the macro takes over, selecting A11:N11 and copying
    > the selection to A2 on Sheet3.
    > The problem with the macro is, it always selects A11:N11. I need it to
    > start where I choose, say, A17, then it selects A17:N17
    >
    > Range("A11:N11").Select
    > Selection.Copy
    > Sheets("Macro").Select
    > Range("A2").Select
    > ActiveSheet.Paste
    > Application.CutCopyMode = False
    > Sheets("Form").Select
    > End Sub
    >
    > Thanks in advance
    >
    >
    > --
    > Archie
    > ------------------------------------------------------------------------
    > Archie's Profile:
    > http://www.excelforum.com/member.php...o&userid=30840
    > View this thread: http://www.excelforum.com/showthread...hreadid=505046
    >




  3. #3
    Tim Williams
    Guest

    Re: Range Select Macro

    if you have a cell in column A selected:


    If selection.cells.count=1 and selection.cells(1).column=1 then
    Selection.Resize(1,14).Copy Destination:=Sheets("Macro").Range("A2")
    Application.CutCopyMode = False
    Sheets("Form").Select 'don't need this if starting on Form
    else
    msgbox "To copy a row, select a single cell in column A"
    end if

    (untested)

    Tim


    --
    Tim Williams
    Palo Alto, CA


    "Archie" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I recorded the macro below.
    >
    > I need a macro that will copy a group of cells. I select the first
    > cell, say A11, and the macro takes over, selecting A11:N11 and copying
    > the selection to A2 on Sheet3.
    > The problem with the macro is, it always selects A11:N11. I need it to
    > start where I choose, say, A17, then it selects A17:N17
    >
    > Range("A11:N11").Select
    > Selection.Copy
    > Sheets("Macro").Select
    > Range("A2").Select
    > ActiveSheet.Paste
    > Application.CutCopyMode = False
    > Sheets("Form").Select
    > End Sub
    >
    > Thanks in advance
    >
    >
    > --
    > Archie
    > ------------------------------------------------------------------------
    > Archie's Profile:

    http://www.excelforum.com/member.php...o&userid=30840
    > View this thread: http://www.excelforum.com/showthread...hreadid=505046
    >




  4. #4
    Registered User
    Join Date
    01-25-2006
    Posts
    2
    Thank you, one and all.

  5. #5
    Kevin Vaughn
    Guest

    RE: Range Select Macro

    Here is a simple little sub to do what you asked. There is no error
    checking. It assumes that the selected cell in the activesheet is the range
    you want. If you are in column B instead of A, it would copy through column
    O rather than column N. You should probably add at least the check if not
    myrange is nothing then before proceeding ...

    Sub myRangeSelect()
    Dim myRange As Range
    Set myRange = Selection
    myRange.Resize(, 14).Copy Sheets("Macro").Range("a2")
    Application.CutCopyMode = False
    End Sub
    --
    Kevin Vaughn


    "Archie" wrote:

    >
    > I recorded the macro below.
    >
    > I need a macro that will copy a group of cells. I select the first
    > cell, say A11, and the macro takes over, selecting A11:N11 and copying
    > the selection to A2 on Sheet3.
    > The problem with the macro is, it always selects A11:N11. I need it to
    > start where I choose, say, A17, then it selects A17:N17
    >
    > Range("A11:N11").Select
    > Selection.Copy
    > Sheets("Macro").Select
    > Range("A2").Select
    > ActiveSheet.Paste
    > Application.CutCopyMode = False
    > Sheets("Form").Select
    > End Sub
    >
    > Thanks in advance
    >
    >
    > --
    > Archie
    > ------------------------------------------------------------------------
    > Archie's Profile: http://www.excelforum.com/member.php...o&userid=30840
    > View this thread: http://www.excelforum.com/showthread...hreadid=505046
    >
    >


+ 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