How to Draw a Line in Bluej
03-08-2014,06:41 AM #1
Registered User
How to DRAW a line in VBA
Attachment 302856Hi everyone,Can somebody help me with my problem.
From here I found a code that can Draw a line through the center of the cells: My question is how to combine these macros so the line will be drawn depending on the week number. I mean so this line can change values: And the second question, how to change color of the line to red? I've tried with this one but with no luck:
I'm trying to make a timeline which moves depending on which week it is. So I define the week number in a cell, search for the the value of this week and get to the cell from where to start drawing a line by using that code:
'.ForeColor.RGB = RGB(255, 0, 0) ' redI've tried in different ways for 2 days now without luck.
I hope somebody can help!
Thanks in advance!
Michael
Last edited by malyshkin; 03-08-2014 at 07:30 AM. Reason: Code editing
03-08-2014,06:56 AM #2
Re: How to DRAW a line in VBA
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.
Highlight your code and click the
# icon at the top of your post window. More information about these and other tags can be found here(This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
Does the cell you search for contain "C1" or "C10". Or is the position of the cell to be used instead of either "C1" or "C10"?
Does the line move or just get longer? Perhaps an example file would help explain your problem
03-08-2014,07:10 AM #3
Registered User
Re: How to DRAW a line in VBA
Hi AndyThank you for your answer,
I've now edited my post with code tags.
For my problem, the Cells "C1" and "C10" is just an example, and yes, I want to define where to Draw a line depending on the week.
I attach an example.
03-08-2014,07:15 AM #4
Re: How to DRAW a line in VBA
Thanks for fixing code tags.Did you attach example file?
03-08-2014,07:19 AM #5
Registered User
Re: How to DRAW a line in VBA
03-08-2014,07:27 AM #6
Re: How to DRAW a line in VBA
Okay so you need to explain, for you file, where should the line be drawn. Where does it start, where does it finish?You have a date in A1 but no other real dates.
03-08-2014,07:47 AM #7
Registered User
Re: How to DRAW a line in VBA
I have just updated the attached file.So, the macro starts at A1, check the week number, finds the corresponding week number in the first row, offsets 7 cells Down (B8) and from there I want it to Draw the line through the middle of the cells to B60.
I just don't know how to combine those to VBA codes, so cell references in this line
Can be changed to the cell references that corresonds to the current week.
03-08-2014,08:12 AM #8
Re: How to DRAW a line in VBA
03-08-2014,12:07 PM #9
Registered User
Re: How to DRAW a line in VBA
Hey Andy,Works just perfect!! I'm trying to get an idea what's going on in the code so I can learn something from it
Again, Thank you very much!!!
Regards,
Michael
12-24-2019,05:05 PM #10
Forum Contributor
Re: How to DRAW a line in VBA
Hi, I saw this old topic and the code. I did search for a similar problem and came here.
I have one question about the code this gives me a error in excel 2019. What is it doing?Thank you
I did start a new thread about this topic here.
Last edited by lord anubis; 12-24-2019 at 06:01 PM.
Source: https://www.excelforum.com/excel-programming-vba-macros/995002-how-to-draw-a-line-in-vba.html
0 Response to "How to Draw a Line in Bluej"
Post a Comment