+ Reply to Thread
Results 1 to 6 of 6

Help Fixing Copy/Paste VBA

  1. #1
    Registered User
    Join Date
    08-19-2010
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    97

    Help Fixing Copy/Paste VBA

    I have this code that I need to tweak a few things on.
    1. I need it to work regardless of the tab name, having some troubles when I take out the worksheet name.
    2. The goal is to copy rows 7:37 and paste in the next available row the selected number of times, but it's not doing it.

    here's the code:

    Please Login or Register  to view this content.
    Last edited by juniperjacobs; 11-07-2011 at 12:30 PM. Reason: SOVLED

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help Fixing Copy/Paste VBA

    Try this:

    Please Login or Register  to view this content.


    Special note: Sheets("1") and Sheets(1) are completely different things.
    Sheets(1) - the first indexed sheet in the workbook, could have any name
    Sheets("1") - a worksheet named "1" found anywhere in the workbook
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Help Fixing Copy/Paste VBA

    Please Login or Register  to view this content.
    Last edited by snb; 11-07-2011 at 01:00 PM.



  4. #4
    Registered User
    Join Date
    08-19-2010
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Help Fixing Copy/Paste VBA

    JBeaucaire:
    The VBA you provided works but only if the tab name matches in the coding. saw your note about "" v. no "", but when i tried to name the code active.sheet or workbook it gave me an error. i want to be able to use the code in whatever active tab i'm in regardless of the name.

    I tried this, but it doesn't seem to work:
    Please Login or Register  to view this content.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help Fixing Copy/Paste VBA

    There is no Active.Sheet reference, it is Activesheet.

    So, this macro is intended to run solely on the activesheet?
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-19-2010
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Help Fixing Copy/Paste VBA

    Thanks JB!

+ 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