Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default String result in Font.Bold style (I need your help please..)

hi Guyz,

I have new challenge at my work and still i am asking your kindness to
lend me some code to be able to finish this task. By the way, the code
i have here is derived from previous topics here but still i am
lacking the gift to accomplish what i want.

Here's the scenatio, i am getting five words from six different cells.
The words from these cells are linked from other tabs within my
workbook except for one word in which it is hard coded.

Here's what i want to happen, when the macro is run the string result
is stated below;

Bold not-bold bold not-bold bold not-bold (six words concatinated).
Words in bold font style will show alternating. And here's my
struggling codes below;

Sub Try()

Dim myRangeA1 As String
'Dim myRangeA2 As String
Dim myRangeA3 As String
Dim myRangeA4 As String
Dim myRangeA5 As String
Dim myRangeA6 As String

myRangeA1 = Sheets("Diary").Range("A1")
'myRangeA2 = Sheets("Diary").Range("A2")
myRangeA3 = Sheets("Diary").Range("A3")
myRangeA4 = Sheets("Diary").Range("A4").Text
myRangeA5 = Sheets("Diary").Range("A5")
myRangeA6 = Sheets("Diary").Range("A6").Text

With Range("A5")

.Value = myRangeA1 & " " & "not Bold" & " " & myRangeA3 & " " &
myRangeA4 & " " & myRangeA5 & " " & myRangeA6

.Characters(1, Len(myRangeA1)).Font.Bold = True

.Characters(1 + Len(myRangeA1) + Len(myRangeA3)).Font.Bold = True

End With

End Sub


Hoping or your kind consideration :-)


Thanks,


jerome
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default String result in Font.Bold style (I need your help please..)

I think you will have to use a loop. Put your concatenated string in a
range, then loop with the characters first letter and length as variables
that change on each loop. The code below is based on a fixed length text in
each concatenated cell of five characters. If you have varying lengths per
cell, then this method will not work.
Sub bldFnt()
myVar = Range("A1").Value & " " & Range("A2").Value & " " & _
Range("A3").Value & " " & Range("A4").Value & " " & _
Range("A5").Value & " " & Range("A6").Value

With Sheets(1).Range("A7")
.Value = myVar
For i = 1 To 31 Step 12
.Characters(i, 6).Font.Bold = True
Next
End With
End Sub


"jhong" wrote:

hi Guyz,

I have new challenge at my work and still i am asking your kindness to
lend me some code to be able to finish this task. By the way, the code
i have here is derived from previous topics here but still i am
lacking the gift to accomplish what i want.

Here's the scenatio, i am getting five words from six different cells.
The words from these cells are linked from other tabs within my
workbook except for one word in which it is hard coded.

Here's what i want to happen, when the macro is run the string result
is stated below;

Bold not-bold bold not-bold bold not-bold (six words concatinated).
Words in bold font style will show alternating. And here's my
struggling codes below;

Sub Try()

Dim myRangeA1 As String
'Dim myRangeA2 As String
Dim myRangeA3 As String
Dim myRangeA4 As String
Dim myRangeA5 As String
Dim myRangeA6 As String

myRangeA1 = Sheets("Diary").Range("A1")
'myRangeA2 = Sheets("Diary").Range("A2")
myRangeA3 = Sheets("Diary").Range("A3")
myRangeA4 = Sheets("Diary").Range("A4").Text
myRangeA5 = Sheets("Diary").Range("A5")
myRangeA6 = Sheets("Diary").Range("A6").Text

With Range("A5")

.Value = myRangeA1 & " " & "not Bold" & " " & myRangeA3 & " " &
myRangeA4 & " " & myRangeA5 & " " & myRangeA6

.Characters(1, Len(myRangeA1)).Font.Bold = True

.Characters(1 + Len(myRangeA1) + Len(myRangeA3)).Font.Bold = True

End With

End Sub


Hoping or your kind consideration :-)


Thanks,


jerome

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does it only bold the number in red when i apply the % style? senorita2009 Excel Discussion (Misc queries) 2 October 5th 09 06:31 PM
Bold Font Peter Piper Excel Discussion (Misc queries) 2 August 12th 09 09:49 AM
How to count number of Cell have Strike Through Effect & Bold as font style. Akash Maheshwari Excel Discussion (Misc queries) 6 June 29th 07 09:39 PM
How to count number of Cell have Strike Through Effect & Bold as font style. Akash Excel Programming 10 June 28th 07 06:28 AM
Bold Font scantor145[_25_] Excel Programming 2 April 17th 06 02:11 PM


All times are GMT +1. The time now is 09:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"