By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,959 Members | 1,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,959 IT Pros & Developers. It's quick & easy.

Macro to Bold Font & Place Border around selected cell.....

P: 34
Hello, I have a basic Excel worksheet that allows users to select:

Yes No Maybe

.... and checkboxes to the right. They unfortunately are complaining that the checkboxes are too small, and I cannot make the boxes larger, so...........

Can someone assist in the macro where they can just click on the cell where "Yes" appears, and it will bold and be outlined, and if they click on that same cell again it will go back to normal (No bold and not outlined)?

Of course same would apply for the "No", and the "Maybe".

I'm hoping this is fairly basic. If not, other suggestions? Button to the right of the "Yes", "No", "Maybe", where if the button is selected the "Yes" (ect... ) will format accordingly?

Thank you.
Jun 18 '08 #1
Share this Question
Share on Google+
4 Replies


kadghar
Expert 100+
P: 1,295
sure, inside the worksheet's code, check the SelectionChange event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2.     Cells.Font.Bold = False
  3.     Target.Font.Bold = True
  4. End Sub
i think that's a good start, aint it?

(^.^ i've just noticed this code is quite fun to play with)

you can also check this howto (im sure you'll find it useful):
http://bytes.com/forum/thread795024.html
Jun 18 '08 #2

P: 34
That is a good start... thanks!

Only thing is that when I click on "Yes", it will bold, however when i click on another cell it will unbold.

I'd like the users to select "Yes" (or "No, ect..) and have it remain bold, then move on to the next question and select Y,N, and have it bold and stay bold, unless they click on it again and it will unbold.

Since we're this far, how would I go about placing a border around it, changing the background / font color.

Thanks again for your help, it is appreciated!
Jun 19 '08 #3

QVeen72
Expert 100+
P: 1,445
Hi,

Try this :

Expand|Select|Wrap|Line Numbers
  1.     Range("A4").Select
  2.     Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous
  3.     Selection.Borders(xlEdgeTop).LineStyle = xlContinuous
  4.     Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous
  5.     Selection.Borders(xlEdgeRight).LineStyle = xlContinuous
  6.     Selection.Font.ColorIndex = 40
  7.     With Selection.Interior
  8.         .ColorIndex = 5
  9.         .Pattern = xlSolid
  10.     End With
  11.  
Regards
Veena
Jun 19 '08 #4

kadghar
Expert 100+
P: 1,295
That is a good start... thanks!

Only thing is that when I click on "Yes", it will bold, however when i click on another cell it will unbold.

I'd like the users to select "Yes" (or "No, ect..) and have it remain bold, then move on to the next question and select Y,N, and have it bold and stay bold, unless they click on it again and it will unbold.
...
well. you'll just have to play a litle bit with som IF / THEN

Expand|Select|Wrap|Line Numbers
  1. if target. column = 1 and target.row=1 then
  2. 'bla bla bla
  3. else
  4. 'bla bla bla
  5. 'end if
HTH
Jun 19 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.