+ Reply to Thread
Results 1 to 5 of 5

"while" loop using VBA on excel 2007

Hybrid View

  1. #1
    Registered User
    Join Date
    03-18-2012
    Location
    Israel
    MS-Off Ver
    Excel 2007
    Posts
    3

    Lightbulb "while" loop using VBA on excel 2007

    Hi,
    I don't know VBA at all. But i do know that it can be used to solve my problem, I'll be glad if someone can show me what i should do.
    I took this data from my excel (the months are on the same column to the right of the number, it got distorted when i copied it):

    212121 January
    February
    March
    April
    May
    June
    313131 January
    February
    March
    April
    May
    June

    what i need to accomplish is copying the number 212121 to each of the cells below it, until it reaches the numer 313131. Then, do the same thing with the number 313131 and the cells below it.
    The latest month doesn't have to be June, its just like that for this example. The requiered result would be:

    212121January
    212121February
    212121March
    212121April
    212121May
    212121June
    313131January
    313131February
    313131March
    313131April
    313131May
    313131June

    by the way, can anyone recommend a the fastest, easiest way to learn VBA?
    Thanks!!

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: "while" loop using VBA on excel 2007

    Hi

    you don't need VBA to do this - it can be done quite quickly with formulas.

    Do you specifically want a VBA solution, or will formulas suffice?

    rylo

  3. #3
    Registered User
    Join Date
    03-18-2012
    Location
    Israel
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: "while" loop using VBA on excel 2007

    Hi!
    Any solution is good, its just that the data sample i copied to the post, is very short. the actual data is very very long, so i thought some VBA is in order.
    but aythung goes.

    Thanks

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: "while" loop using VBA on excel 2007

    Hi

    If your data is in the range A1:B12, then select the range A2:A12, Select the home tab, Find and Select, Go To Special, Blanks, OK, =a1, ctrl enter. If you only want value results, then select column A, copy, pastespecial values.

    HTH

    rylo

  5. #5
    Registered User
    Join Date
    03-18-2012
    Location
    Israel
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: "while" loop using VBA on excel 2007

    wow.
    super elegant, thanks!

+ 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