+ Reply to Thread
Results 1 to 10 of 10

Run recorded macro based on current sheet, not the original sheet

  1. #1
    Registered User
    Join Date
    08-22-2012
    Location
    Ottawa, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    6

    Run recorded macro based on current sheet, not the original sheet

    Hi,

    I took a quick look and couldn't find quite what I am looking for so I figured I'd ask the question instead.

    I'm working on a document that's borderline database, but I need to be able to do the entire thing in excel instead of access. Essentially what I'm doing is using the workbork to create individual reports for a group of people. This is how it works:

    There is a tab for each person (instructors). They are being evaluated by a number of different people and on a number of different criteria. The data is all entered on the instructors individual tab. I'm in the development phase so I currently only have three test tabs (WO1 Bloggins, WO2 Smith, FSGT Cadet).

    Now there is a fourth tab labeled "Report". What I've done is created a macro to put on each tab to populate the individual reports. When I'm on WO1 Bloggins I want to click "Report" and populate a report for that instructor, when I'm on the WO2 Smith sheet I want to be able to click "Report" and have the same report template populate with the information on the WO2 Smith tab.

    Right now when I'm on the WO2 Smith tab and click my report button the "Report" tab get's populated with the information from the WO1 Bloggins tab since that's where I recorded the macro.

    I'm not overly familiar with macros and VBA so any help on this would be greatly appreciated.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Run recorded macro based on current sheet, not the original sheet

    How about providing the forum with the macro you recorded? How are we supposed to help otherwise?
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Run recorded macro based on current sheet, not the original sheet

    Hard to tell without seeing your code.. Post your code and or workbook and I'm sure someone can help.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  4. #4
    Registered User
    Join Date
    08-22-2012
    Location
    Ottawa, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Run recorded macro based on current sheet, not the original sheet

    Please Login or Register  to view this content.
    That's the code I have, there's a lot of the same action (copy from one sheet, paste to another) and back and forth. I cut all those out since it's the same as the above, with a different cell being referenced.
    Last edited by Cutter; 08-22-2012 at 06:20 PM. Reason: Added code tags

  5. #5
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Run recorded macro based on current sheet, not the original sheet

    Hello there,

    Could you post your recorded code?

    It should just be that you change the lines that look like

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-22-2012
    Location
    Ottawa, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Run recorded macro based on current sheet, not the original sheet

    I had tried a few things like that, but I wasn't sure how to use the activesheet function.

  7. #7
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Run recorded macro based on current sheet, not the original sheet

    If you want to clean up your code you could update it to look like this

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-22-2012
    Location
    Ottawa, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Run recorded macro based on current sheet, not the original sheet

    Thanks, that's exactly what I was looking for. Cleaned up, and it's doing what I want it to do. Thanks again!
    Last edited by Cutter; 08-22-2012 at 06:21 PM. Reason: Removed whole post quote

  9. #9
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Run recorded macro based on current sheet, not the original sheet

    Glad to hear it!

  10. #10
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Run recorded macro based on current sheet, not the original sheet

    @ magillmjl

    Welcome to the forum. Nice to see your problem has been solved already, but:

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

+ 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