+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Forum Contributor amyxkatexx's Avatar
    Join Date
    11-23-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    128

    [SOLVED] Select Range with Starting Cell Unknown

    I am trying to record a macro that will allow me to select from whatever cell is active at the time of running the macro to BR2. I am then copying the information selected and pasting it into a new spreadsheet. If it is not possible to record a macro this way, then can I edit the macro to allow me to do so?

    This is what I have recorded already...

    Code:
        Range("BR2:EL17").Select
        Range("EL17").Activate
        Selection.Copy
        Windows("FTH_RunningSpreadsheetCHS.xls").Activate
        Range("A2").Select
        ActiveSheet.Paste
    End Sub
    EL17 is not important, it will always be in column EL, but there will always be a different number of rows I need to copy. I know I could just set it to copy from EL500 or something like that because I would never have that many rows; however, I do not want to copy excess information and then go back and delete.

    Hope this makes sense and I'm sorry if this is a repeat question, I looked for a while first and couldn't find an exact answer to this.
    Last edited by amyxkatexx; 11-24-2009 at 10:52 AM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,714

    Re: Select Range with Starting Cell Unknown

    You must add code tags - see 'How To' at the top of the page.

  3. #3
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,137

    Re: Select Range with Starting Cell Unknown

    As Stephen requested, please take a few minutes to read the forum rules, and then edit your post to add code tags.

    Thanks.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor amyxkatexx's Avatar
    Join Date
    11-23-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    128

    Re: Select Range with Starting Cell Unknown

    Add code tags for what?

    Also, I understand how to run my macro, I just need to edit it or record a new one.

    Sorry, I am new at this, and I don't usually post on forums because I don't know how to word my questions a lot of times.

  5. #5
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,137

    Re: Select Range with Starting Cell Unknown

    Your question is fine. You need to add CODE tags around your code. The way to do that is described in both the forum rules, and in the How To, both accessible from the menu bar.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Contributor amyxkatexx's Avatar
    Join Date
    11-23-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    128

    Re: Select Range with Starting Cell Unknown

    I think I get what you mean now about code tags now, I added them to my post. I read the how to and thought it was saying to add the code to my macro and I was really confused. I fixed it now though.

  7. #7
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,137

    Re: Select Range with Starting Cell Unknown

    Thank you. Try
    Code:
        Range(ActiveCell, "BR2").Copy _
                Destination:=Workbooks("FTH_RunningSpreadsheetCHS.xls").Range("A2")
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Forum Contributor amyxkatexx's Avatar
    Join Date
    11-23-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    128

    Re: Select Range with Starting Cell Unknown

    Is that the only code needed or do I keep any of my original code? I removed my original code and just used that and I got a run-time error 438. It says "Object doesn't support this property or method"

  9. #9
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,137

    Re: Select Range with Starting Cell Unknown

    Sorry, you also need to specify the worksheet:
    Code:
     Range(ActiveCell, "BR2").Copy _
                Destination:=Workbooks("FTH_RunningSpreadsheetCHS.xls").Worksheets("???").Range("A2")
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  10. #10
    Forum Contributor amyxkatexx's Avatar
    Join Date
    11-23-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    128

    Re: Select Range with Starting Cell Unknown

    Thank you, thank you, thank you!!

    It works perfectly!

    Sorry it took me so long to get it!

    Thanks again!

  11. #11
    Forum Contributor amyxkatexx's Avatar
    Join Date
    11-23-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    128

    Re: Select Range with Starting Cell Unknown

    Oh no, I just realized a problem with this now.

    Since I am going to be pasting new information into a running spreadsheet, I will also not always be pasting in A2. I will want to paste in column A still, but start wherever I left off before. Is that possible to do as well?

  12. #12
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,137

    Re: Select Range with Starting Cell Unknown

    Perhaps ...
    Code:
        With Workbooks("FTH_RunningSpreadsheetCHS.xls").Worksheets("???")
            Range(ActiveCell, "BR2").Copy _
            Destination:=.Cells(.Rows.Count, "A").End(xlUp)(2)
        End With
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  13. #13
    Forum Contributor amyxkatexx's Avatar
    Join Date
    11-23-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    128

    Re: Select Range with Starting Cell Unknown

    You got it!

    Man, I wish I could understand programming. Even knowing simple stuff like that would make my life easier, but I just don't get it...

    Oh well, maybe some day it will all click for me.

    Thanks!!

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.2.0