473,322 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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

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
4 2361
kadghar
1,295 Expert 1GB
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
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
1,445 Expert 1GB
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
1,295 Expert 1GB
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

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

Similar topics

23
by: Bob Bedford | last post by:
I've a table. The table must not have any border. The TR (every line) must have a border, but not the lines between cells. The TR.pages must have no border. so .mytable{border:0px;} ...
3
by: effendi | last post by:
Hi Can any tell me what is the javascript equivalent of CSS border? I would like to change the border of my cell when it is set on focus. I have tried onFocus="style.border='3px'" but it is not...
3
by: Mike Mimic | last post by:
Hi! I noticed that for the following code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
12
by: plugwalsh | last post by:
Hi I need to generate an HTML table that looks like the following: (Two cells, A & B) ------------------- | | | | | B | | | | | |--------|
0
by: derelict | last post by:
Hey all, im getting desperate now. I have a macro running in Word 2003, when I run the macro it *should* put a 'bottom' cell border in each cell that has the style used - this included a border at...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
0
by: =?Utf-8?B?TGV0emRvXzF0?= | last post by:
I'd like to create a Macro that will sort some raw data, apprx 20k lines, remove some lines based upon a condition in a certain column. Then copy this data into a new spreadsheet and sort the ...
0
by: acarrazco | last post by:
Hello, I am totaly new to VBA and I'm trying to modify a macro that was given to me but it doesn't seem to be working. I'm trying to extract data from three excel spreadsheets, put it into a combined...
1
by: gmcconville | last post by:
Im a little bit stuck on how to change a cell in a datagridview to bold without affecting any of the other attributes of the cell, such as underline, italic etc. This is what I thought would work...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.