+ Reply to Thread
Results 1 to 6 of 6

Spreading a list to multiple worksheets

  1. #1
    Registered User
    Join Date
    02-19-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    3

    Spreading a list to multiple worksheets

    Hi All -

    I have a list of regions on one worksheet, say cells A10:A50, and I have 40 other worksheets in the same workbook. Starting with the first value in the list, I want to copy it to cell A1 on the first worksheet, and so on so that each of the other worksheets has one unique value in cell A1.

    Can someone please help me with code for this?

  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: VBA Help - spreading a list to multiple worksheets

    Assuming all 40 sheets really do exist and you don't need sheets added for you (which might actually be easier)...

    Please Login or Register  to view this content.

    This macro will spot the number of actual values in the range, then copy them into A1 starting on the second sheet.
    _________________
    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 Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: VBA Help - spreading a list to multiple worksheets

    Hi

    I think you will need something like the code below

    Please Login or Register  to view this content.
    Please amend according to your requirement. The code current assumes that the worksheets already exist and that it is just 40 rows from A10 that are being evaluated.

    Hope it helps

  4. #4
    Registered User
    Join Date
    02-19-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Spreading a list to multiple worksheets

    Great. That worked. Thanks for the help.

  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: Spreading a list to multiple worksheets

    ExcelXX, you are writing your code from a human perspective, activating cells and offsetting...in VBA you do not have to address cells in the same manner. The macro recorder shows you code like that because it is recording human actions, not good methods.

    Physically activating or selecting cells should be unnecessary 99% of the time, so look for ways to process your data without it.

    BTW, what did "assuming row 1 has headers" mean in your code? Was that an errant comment?

    =========

    Pulte, if that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].

    (Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated. It is found across from the "time" in each of our posts.)

  6. #6
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Spreading a list to multiple worksheets

    Hi JBeaucaire

    Thank you for the feedback. I'll bear it in mind when writing code in the future.

    Yes the comment about row 1 was an errant comment, when I initially wrote the code it started evaluating from the A1. As a result, I started the copying process from the second row.

+ 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