+ Reply to Thread
Results 1 to 27 of 27

Instead of Range being By Column, Making for a Certain ColorIndex

  1. #1
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Instead of Range being By Column, Making for a Certain ColorIndex

    How Would i make a range of a Intersect Statement be a color instead of columns.

    Kinda like this but functional....

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Hi Codeman,

    You can test each cell in the Target Range:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    OK so how would i change this function from making the range a column to a Color

    Please Login or Register  to view this content.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    If I understand what you're doing then Maybe:

    Please Login or Register  to view this content.
    Last edited by xladept; 05-29-2013 at 03:37 PM.

  5. #5
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    It didnt work. So Basically i have a Time Entry Sheet that we will have filled out. I am trying to make it easier when entering time and that is why this code takes out the need of a colon. The problem is that the Entry Spots are not all linear and so i figured defining the range by color instead of column would work out better.

    What i want the code to do is If the Cell color is "yellow" than it does the time format otherwise excel does its normal thing.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Hi Codeman,

    I always edit after posting - try it now - it's tested and working for me - sorry!

  7. #7
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Its Works!!!! Thanks!

    While i have you hear how could you make it so that if i type say just 12 it would convert to 12:00 instead of 12:12.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    I'll get back to you on that.
    Last edited by xladept; 05-29-2013 at 04:09 PM.

  9. #9
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    It Just comes back as 12:00 now no matter what.

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Hi Codeman,

    I couldn't make the Time functions work with any regularity. See if this works for you:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    I Put your code in and it just made the number some long date. So i assume it doesn't work. The Single Digit part isnt very important i was just wondering if there was something simple that could be changed to make it work.

  12. #12
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Hi Codeman,

    What are you entering? It worked for me:
    when I entered 12 - I got 12:00 PM
    when I entered 13 - I got 1:00 PM etc???

  13. #13
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Never mind it is working now but when i put in something like 230 it gives me the long date
    Last edited by Codeman553; 05-30-2013 at 11:59 AM.

  14. #14
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Do you want code to handle an entry like 230??

  15. #15
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Ya because when we input time into it generally 99.9% of the time it will be formatted like this #:00, #:15, #:30, #:45 AM/PM. I just figured if it would be quicker if it could handle putting in a single 2 to mean 2:00 instead of 12:02

  16. #16
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Do you run more than one shift? Is an entry of 730 7:30 AM and an entry of 1:15 1:15 PM? What are the criteria for the entries - will 2:30 PM be entered as 1430???

    How shall we change this?

    Please Login or Register  to view this content.
    Last edited by xladept; 05-31-2013 at 07:01 PM.

  17. #17
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Yes the guys clock in multiple times a day. Up to 10 clock in and clock outs in one day.

  18. #18
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    I need it to handle entering PM or P for PM. right now if i put 5p or 5pm it does 5p: than errors.

  19. #19
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Hi Codeman,

    Here's the next version

    Please Login or Register  to view this content.
    Last edited by xladept; 06-03-2013 at 08:57 PM.

  20. #20
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Works Wonderfully! I really appreciate all your help. Just started in the VBA area. I come from C# and Java background. Thanks again man!!!!

    Edit:
    Did find one bug when i type something with "AM" i get 23:0m AM.
    Last edited by Codeman553; 06-04-2013 at 10:06 AM.

  21. #21
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Hi Codeman,

    Just one bug? I'll check that out - I want to take the processing out of the range anyway - anon!

  22. #22
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Ya as far as i have seen thats it. Thanks!

  23. #23
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Hi Codeman,

    I think I fixed that bug and I put the processing in core where it belongs it's not as pretty as I'd like but it may work now. C# and Java huh? I guess it's a different mindset???

    Please Login or Register  to view this content.

  24. #24
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    OK ill take a look. Ya i understand the most of the global syntax that most language shared its just trying to learn specific syntax of vba that i am struggling. Been out of the game for a while now.

  25. #25
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Hi Codeman,

    Replace(!) the last routine with this:

    Please Login or Register  to view this content.

  26. #26
    Registered User
    Join Date
    05-23-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Haha i remember those days when although something works you find it atrocious to look at so its time to clean it up. Just replaced it works great.

  27. #27
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Instead of Range being By Column, Making for a Certain ColorIndex

    Hi Codeman,

    Those days never die - they just fade away

+ 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