+ Reply to Thread
Results 1 to 9 of 9

VBA Cycle Help

  1. #1
    Registered User
    Join Date
    09-21-2011
    Location
    U.S.A
    MS-Off Ver
    Excel 2007
    Posts
    1

    VBA Cycle Help

    Hi.

    I need a VBA script to find five-digit numbers where the five-digit number is the addition of each digit raised to the power of 5.

    I mean: vwxyz= (v^5)+(w^5)+(x^5)+(y^5)+(z^5) where vwxyz is just the numbers themselves not the product.

    I would like to execute it in a cycle to see the other solutions.

    Thanks
    Last edited by Paul.127; 09-21-2011 at 12:05 PM.

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: VBA Permutations Code

    Do you need VBA? or would something like this (see attached) suffice?
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: VBA Permutations Code

    Here's the VBA code to do it and write the output to the end of column A in sheet 1...

    Please Login or Register  to view this content.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Permutations Code

    Hi,

    Sounds suspiciously like a homework question but I'll give you the benefit of the doubt

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

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

    Re: VBA Permutations Code

    If you want to prove you didn't figure it out yourself use:

    Please Login or Register  to view this content.
    Last edited by snb; 09-21-2011 at 06:43 AM.



  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Permutations Code

    Quote Originally Posted by snb View Post
    If you want to prove you didn't figure it out yourself use
    Masterful! I like it

  7. #7
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: VBA Permutations Code

    I do love snb's code, but I'm puzzled by the paradox that if people follow the advice on line 1 of snb's sig then probably none of it ever gets used, i.e. if you trust everything that snb tells you then you'll never use any of their advice

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

    Re: VBA Permutations Code

    You can translate the signature also into:

    'Please, analyse the code before using it; if you have done so you will have expanded your VBA-coding scope, and be able to adapt the code.'

  9. #9
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: VBA Permutations Code

    Now I admire your code AND your optimism

+ 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