• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Bold for 1 word in VBA [SOLVED]

ganzzu

New Member
Hey,


I have the following code:


ElseIf UCase(e.Cells(xee, 5).Value) = "SCHOOLS" Then

o.Cells((6 * (j - 1) + q), 6).Formula = "[Sch]: " & e.Cells(xee, 3).Value


It does the following thing: when 'Schools' are selected from a drop-down list, '[Sch]:' text is displayed in the sheet that contains the data.


How can I make that particular text '[Sch]:' to be displayed in Bold?


Thanks!
 
Hi Narayan,


Thanks for your response. I tried your formula but, for some reason, it does not entirely work. There may be some other dependencies in the code. I will check a bit more to see if I see something else there.


Thanks again!
 
Hi again,


Tried various ways of making that text bold, but no results. Every time I try something, it keeps displaying only the value in 'e.Cells(xee, 3).Value' and it does not also add '[Sch]:' text.


Any other ideas on how I can resolve this?


Thanks!
 
Hi ,


If it does not add the text , then obviously it will not show it in BOLD ; what is your problem , the fact that the text [Sch]: does not appear in the required cells , or the fact that the text appears , but is not displayed in BOLD ?


If it is the former , is the following statement executing without an error ?


o.Cells((6 * (j - 1) + q), 6).Formula = "[Sch]: " & e.Cells(xee, 3).Value


This is the statement from your original post. Can you copy + paste the exact line of code that you have in your procedure ?


Narayan
 
Hi Narayan and thanks again for trying to help,


Maybe the details a tried to give earlier were not so clear. I was saying that I tried to modify the code so that it displays the needed BOLD chars, but I either wrote something wrong (and the error was displayed) or it simply didn't display the '[Sch]:' text at all.


The only portion of the code that refers to adding some data into a specific cell is this (the same from 1st post):


If UCase(e.Cells(xee, 5).Value) = "SCHOOLS" Then

o.Cells((6 * (j - 1) + q), 6).Formula = "[Sch]: " & e.Cells(xee, 3).Value


So, if 'Schools' is selected for a particular event, then the main datasheet should display in one of the cells, using this formula, the following: '[Sch]: event name'.


Thanks again!
 
Hi Narayan,


I've been a little dumb. The code you gave me in 2nd post works fine and solves the issue, but instead of adding it below, I replaced 2nd line of my own code.


I think it's obvious I'm a begginner at VBA and I'm sorry if a made you waste some more time on this and big thanks for help.


Many thanks!
 
Back
Top