+ Reply to Thread
Results 1 to 6 of 6

VB Cell Loop insert same formula.

  1. #1
    Registered User
    Join Date
    06-30-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    10

    VB Cell Loop insert same formula.

    Hi guys, can I have some help please.

    I need to loop through each cell in column B
    If the length of the text is 2 then a prefix of four Zeros should be added to make 6 characters
    If its length 3 then 3 zeros to make it 6 characters.

    I done it as a formula for one specific cell but can i have help converting it to VB?!!!
    Please

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: VB Cell Loop insert same formula.

    Try this:

    Please Login or Register  to view this content.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: VB Cell Loop insert same formula.

    Note as a formula you could just use =TEXT(B114,"000000")

    Dom

  4. #4
    Registered User
    Join Date
    06-30-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: VB Cell Loop insert same formula.

    Dom, that works a charm, thank you very much. I really really appreciate the help!

  5. #5
    Registered User
    Join Date
    06-30-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: VB Cell Loop insert same formula.

    Quote Originally Posted by Domski View Post
    Note as a formula you could just use =TEXT(B114,"000000")

    Dom
    Doh so easy and I did it the long way!

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,331

    Re: VB Cell Loop insert same formula.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Everyone who confuses correlation and causation ends up dead.

+ 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