Formating query

M

Mal

I use excel as a database for storing / manipulating info
for my web site which deals with bird checklists. The bird
names are entered as follows... Common Buzzard (bold)
space, Buteo buteo (italicised). My problem is that I have
to merge the two tables (bold name) & (latin name in
italics) into one cell but I cannot get the formating to
stay. That is, the italicised name always follows the
original cell format. Is there a symbol or control symbol
I can insert between the bold and italic names to maintain
the formating? I can change the format manually but with
20,000 entries to change it might take some time!

thanks
 
D

Dave Peterson

You can't mix formatting in cells that contain formulas. But you could have a
macro that combines the values and formats the resulting value.

I don't know how your table is laid out, but I guessed Column A and Column B.
And I put the resulting string in column C.

Option Explicit
Sub testme01()

Dim myCell As Range
Dim myRng As Range

Set myRng = Selection.Columns(1)

For Each myCell In myRng.Cells
With myCell.Offset(0, 2)
.Value = .Offset(0, -2).Value & " " & .Offset(0, -1).Value
.Characters(1, Len(.Offset(0, -2).Value)).Font.Bold = True
.Characters(Len(.Offset(0, -2).Value) + 1).Font.Italic = True
End With
Next myCell

End Sub

Select your range and try running this macro.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
O

onedaywhen

By definition, data is not formatted. Persist the raw values in the
database and do the formatting in the front end. Similarly, have two
separate columns for English name and Latin name respectively and do
the concatenation (with parentheses) in the front end.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top