+ Reply to Thread
Results 1 to 6 of 6

Running code for three sets of worksheets

  1. #1
    Registered User
    Join Date
    07-13-2013
    Location
    syracuse, ny
    MS-Off Ver
    Excel 2003
    Posts
    9

    Exclamation Running code for three sets of worksheets

    Hi, I have a vba problem that probably has a very easy answer.
    I have the code below which formats a table so that I can make a pivot table out of it. What I need to do now is to apply this code to 3 different sets of worksheets. The first set (below) takes data from "M) Avg Hrs- Month" and formats the values into a table labeled "M) Data for PT." I know need this code to run for "A) Avg Hrs- Month"/ "A) Data for PT" and "N) Avg Hrs- Month"/"A) Data for PT." I canot just copy and paste the code and change the names of the worksheets it uses because the variable names are the same.

    Thanks in advance everyone!! I am a BIG vba novice so any help is appreciated!

    A sample workbook is attached!


    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Running code for three sets of worksheets

    Cross posted here with a solution: http://www.excelforum.com/excel-prog...st-column.html
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Running code for three sets of worksheets

    I was mistaken in reply #2 - sorry.

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Running code for three sets of worksheets

    ag123,

    With your latest attached workbook containing the following three worksheets, and, no formulae as per your other thread:
    M) Avg Hrs- Month
    N) Avg Hrs- Month
    A) Avg Hrs- Month


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgDataForThree macro.
    Last edited by stanleydgromjr; 07-15-2013 at 08:47 AM.

  5. #5
    Registered User
    Join Date
    07-13-2013
    Location
    syracuse, ny
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Running code for three sets of worksheets

    You are a LIFESAVER! Thank you so much!!!!

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Running code for three sets of worksheets

    ag123,

    Thanks for the feedback.

    You are very welcome. Glad I could help.

    Come back anytime.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. 2 different sets of code in 1 tab
    By fionaby in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-10-2012, 05:45 AM
  2. How to match two sets of data between two worksheets
    By humptydumpty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2010, 04:48 AM
  3. Transferring Data Sets Between Worksheets
    By eichstadt28 in forum Excel General
    Replies: 3
    Last Post: 04-14-2009, 12:16 PM
  4. Error code when I run 2 sets of code.
    By richard11153 in forum Excel General
    Replies: 1
    Last Post: 11-28-2008, 02:33 AM
  5. Hiding and Unhiding two sets of worksheets
    By Glio in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-14-2008, 03:09 PM

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