+ Reply to Thread
Results 1 to 9 of 9

If cell matches criteria, add 0000000

  1. #1
    Registered User
    Join Date
    07-03-2012
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    40

    If cell matches criteria, add 0000000

    Hi everyone, I'm completely stupid when it comes to VBA.

    Here's is some semi-pseudo code for what I'm trying to accomplish.

    Please Login or Register  to view this content.
    How should I implement this?
    It is crucial that it only affects cells that match the if clause.

    Your help is really appreciated!

    Best regards,
    Knut

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,645

    Re: If cell matches criteria, add 0000000

    Do you mean this:
    Please Login or Register  to view this content.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,939

    Re: If cell matches criteria, add 0000000

    Are they leading or trailing zeroes?

    If they are trailing zeroes and you still want the cell to be numeric, you could multiply the value by 10,000,000.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    07-03-2012
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: If cell matches criteria, add 0000000

    Quote Originally Posted by TMShucks View Post
    Are they leading or trailing zeroes?

    If they are trailing zeroes and you still want the cell to be numeric, you could multiply the value by 10,000,000.


    Regards, TMS
    They are trailing zeroes. I did actually try this solution too, but my main issue is that nothing happens to the cells.

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: If cell matches criteria, add 0000000

    Then do it this way,

    Please Login or Register  to view this content.
    Hope that Helps.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  6. #6
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: If cell matches criteria, add 0000000

    One more approach..

    Please Login or Register  to view this content.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,939

    Re: If cell matches criteria, add 0000000

    It might be worth posting a small but typical sample of your data.

    Regards, TMS

  8. #8
    Registered User
    Join Date
    07-03-2012
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: If cell matches criteria, add 0000000

    Quote Originally Posted by Winon View Post
    Then do it this way,

    Please Login or Register  to view this content.
    Hope that Helps.
    This helped me a lot! I finally understood what I did wrong. Thank you! :-)

    Quote Originally Posted by Debraj Roy View Post
    One more approach..

    Please Login or Register  to view this content.
    Whoa! This solution was by far the best with my dataset. It finishes in about 1/18 the time of the first suggestion.

    Quote Originally Posted by TMShucks View Post
    It might be worth posting a small but typical sample of your data.

    Regards, TMS
    With Debraj's apporach I have found a fitting solution.

    Thank you very much everyone! Your help is immensely appreciated.

    Regards, Knut

  9. #9
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: If cell matches criteria, add 0000000

    Glad that you liked it..

+ 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. Copy whole row if criteria matches one cell
    By HayleyH86 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-21-2013, 07:33 PM
  2. Finding last cell that matches criteria
    By taketwo in forum Excel General
    Replies: 2
    Last Post: 02-09-2011, 02:55 PM
  3. SUM values when criteria matches more than one cell
    By ABSTRAKTUS in forum Excel General
    Replies: 3
    Last Post: 12-10-2010, 03:53 PM
  4. Populating Cell Only If Multiple Criteria Matches
    By mcarcharocles in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-27-2008, 10:22 AM
  5. Cell address if value matches some criteria
    By asamani in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-04-2007, 12:51 PM

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