Format cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am pulling two different fields from an Access database and putting them
into one cell in Excel. This works fine. What I need to know is to BOLD and
UNDERLINE the first field in the cell but not the second field. Can this be
done?

The variable names are:
var_ID
Var_Name
 
turn on the macro recorder and do it manually.

Turn off the macro recorder and look at the code.
 
Tom,

I turned the Macro Recorder on. When I BOLD the item manually, I get a
message that says, "Unable to record". What is going on?
 
I don't know. I did it manually and recorded:
ActiveCell.FormulaR1C1 = "abcd-efgh"
Range("F3").Select
ActiveCell.FormulaR1C1 = "abcd-efgh"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleSingle
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=5, Length:=5).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("G3").Select

Which could be culled down to

Sub mySub()
With ActiveCell
.FormulaR1C1 = "abcd-efgh"
With .Characters(Start:=1, Length:=4).Font
.Bold = True
.Underline = True
End With
End With
End Sub
 
Only problem with that is is assumes that the var_ID is always 4
characters long. If this is the case hen there wont be a problem.

How are you importing the values from Access and how are you combining
them?
 
Glad your back, everyone is waiting to see your solution:

" a user interface thing where you ask the person to check for duplicates,
if they hit yes it
pauses the code and resumes on enter?"
 

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

Back
Top