+ Reply to Thread
Results 1 to 22 of 22

Belonging Row is not clear in Code

  1. #1
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Belonging Row is not clear in Code

    Hi @ all,

    I have the following Code

    Please Login or Register  to view this content.

    Situation:

    This code marks given events in "K" in a timeline at the right place in the year - okay!
    But unfortunately it does not only mark the given date (inrow "k") in the timeline. It marks the whole timeline...


    Would you be so kind to adopt the code that only the date which is given in row "K" is marked?
    It is not necessary to mark a period. It should just show what is in row "K".


    Thank you in advance from Germany
    Last edited by Julian Schubert; 06-22-2011 at 05:33 AM.

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

    Re: Adopt Code

    I think that by using the debugging tool in the VBEditor you will be perfectly able to see what the code does and to improve it. Especially when applied to the workbook with real data (that we haven't been provided with).
    Better than asking for a solution is acquiring the means, methods and ability to solve problems yourself.



  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Adopt Code

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Belonging Row is not clear in Code

    hi, Julian Schubert, you compare each value in Sheets("Sheet1").Range("A4:NB4") with k and k.Offset(0, -1), what is the condition for colouring k?
    Last edited by watersev; 06-22-2011 at 06:00 AM.

  5. #5
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    Hello Waterserv,

    find attached the file.
    I think it is easier to look at it than to describe it.

    The aim is that the code automatically looks at row "K" and marks the given dates (from "K") in the Timeline in "Sheet1".

    And are you in the position to make the timeline grey(light) and mark events red?

    Thank you
    Attached Files Attached Files
    Last edited by Julian Schubert; 06-22-2011 at 07:37 AM.

  6. #6
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    @snb:

    what do you mean by
    the debugging tool in the VBEditor
    ?

    If it is what I think it is... I tried but I did not manage to solve my problems in the code...


    Thank you

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Belonging Row is not clear in Code

    @ Julian Schubert, what should happen if August 4, 2011 is selected? We need to colour 04.08.2011 and till the NB4 on Sheet("Sheet1")?
    Last edited by watersev; 06-22-2011 at 08:21 AM.

  8. #8
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    Thank you waterserv.
    Unfortunately an error occurs:

    Run-time error "13"
    Type missmatch

    and this line gets marked yellow


    Please Login or Register  to view this content.

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Belonging Row is not clear in Code

    Try replacing:
    Please Login or Register  to view this content.
    with:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

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

    Re: Belonging Row is not clear in Code

    Debugging: use F8

    DateDiff("d", Cdate("01.01.2011"), Target)

  11. #11
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    still not working

    put in this code now


    Please Login or Register  to view this content.

    does not work....

    same error occuring... missmtach... run-time error...

    have you tried out the code in my file?

  12. #12
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Belonging Row is not clear in Code

    you misplaced coma and round bracket after offset, it should be:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    okay now it is working - but the whole timeline is red know...

    I do not see any changes :-)

    It would be wonderful if just the exactly event in the timeline is red... and the line grey...

  14. #14
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Belonging Row is not clear in Code

    colour the timeline in grey, and try again

  15. #15
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    I already did, but it gets red every time again... do not worry I am working with you





    I just saw that there is a code in "Sheet1", is that influencing the whole process?

    Code "Sheet1"


    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    Thank you in advance.

  17. #17
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Belonging Row is not clear in Code

    Quote Originally Posted by Julian Schubert View Post
    I just saw that there is a code in "Sheet1", is that influencing the whole process?
    Yes, it colours the whole row

    Please check attachment, I'm using Excel 2003 so I do not have so many columns as you do, but you'll be able to see how it works. Change date 10.03.2011 to say 10.02.2011
    Attached Files Attached Files
    Last edited by watersev; 06-22-2011 at 10:19 AM.

  18. #18
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    sorry for the late answer - other projects...

    so now my situatuion is that I am not smarter than before because I do not understand your attachement or at least how I can benefit of it

    So now my timeline works, but it still marks the whole row and I would be happy if only the date in Row 'K' (for ex 22/08/2011) gets marked on the timeline.

    And it only shows the first entry in row "K" in the timeline and not the following.


    Furthermore, the timeline is still completely red and I would be happy if the timeline is grey and the selected dates are marked red.


    In addition, is it possible that I have 3 timelines (4 years (2010/2011/2012/2013)) each under the other... ?
    ... I want to solve the problem that I have dates of different years in row K...


    Find attached again the file.
    Can you change it the way I want to have it?.

    Thank you very much in advance.
    Julian
    Attached Files Attached Files

  19. #19
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Belonging Row is not clear in Code

    please check attachment, insert dates in K3:K5 on Sheet2 and check result on Sheet1, the code is in Sheet2 module. It's done only for 2011
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    Hello waterserv,

    Thank you for your file!

    Unfortunately, it does not work - If I insert dates in K3:K5 on Sheet1 an error occurs:

    Run-Time error '13'
    Type missmatch

    Can you help me again pls?

    Thank you.

  21. #21
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Belonging Row is not clear in Code

    hi, Julian, the dates are entered on Sheet2, everything works as it should, check attachment for result of three dates entered
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    06-21-2011
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Belonging Row is not clear in Code

    Hello waterserv,

    Thank you again.

    I do not why but it does not work for me... Even when I just try to change a date you have already entered.

    He gives me the same 'runtime error' and marks

    this row

    Please Login or Register  to view this content.
    yellow...


    Dou you know the solution?
    Do you use Excel 2007?

    Thank you for your support.

+ 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