Hi all,
registered just to ask this question as its fustrating me. I have some knowledge of how VB works - i did a module on it in college (years ago!) but have forgoten everything. i dont use excel or vb everyday - which is why this question will probs be easy to some people.
I am trying to do a very simple macro button.
I want to be able to click the button and for it to fill in a cell with a colour and a boarder. Also one to delete everything so its a blank 'skeleton' worksheet.
The problem i have is that the code below is looking at cell Q13. I want to be able to manually sellect the cell. Is there code for this or there maybe a different way of writing the code, however ive forgotten all the useful stuff from college.
Sub Projected_Time() ' ' Projected_Time Macro ' Fill cell with grey box ' ' Keyboard Shortcut: Ctrl+d ' Range("Q13").Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorDark1 .TintAndShade = -0.499984740745262 .PatternTintAndShade = 0 End With Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With End Sub
I think making the clear sheet button will be alot easier :D but if someone can help me with the top line of this code i would be very greatful.
Thanks
Last edited by Dowsett; 01-27-2012 at 07:12 AM. Reason: mods...
deleted post
Last edited by tom1977; 01-27-2012 at 07:06 AM.
Regards
tom1977
If You are satisfied with my solution click the small star icon on the left to say thanks.
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 POSTYour post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
not sure where to put that code, or is that the whole code?
Ive tried putting it at the start and also using it as the whole code but neither works.
First thing that you need to do is to read the Forum Rules then do as I have asked in my previous post
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks