MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Keep cell font bold off

  Asked By: Diane    Date: Jan 30    Category: MS Office    Views: 2165

I am usding the following code to insert a row between two rows.
These two rows have bold font. I wnat to insert rows between two
rows and also want to keep the font of nwely inserted rows as
regular font ie without bold. THis code keeps the bold off when the
row is inserted. But as soon as a text data is written on the cell ,
it is converted to bold.

Suppose A7 and A8 is bold font cells. NOw I am inserting a row at A8
with this code. Bold for A8 is kept off with this code but as soon
as a data is entered in A8 it is converting to bold which I wnat to
keep normal ie without bold.

Sub insertrow()
ActiveCell.Font.Bold = False
ActiveCell.Font.Bold = False
End Sub

Why is this happening? How to correct this?



6 Answers Found

Answer #1    Answered By: Roxanne Dixon     Answered On: Jan 30

I took your code  and copied it into an Excel Module. I bolded A7 & A8, selected
A8, ran the macro and it ran fine for me. I even took out the last two lines
with no problem.

Sub insertrow()
ActiveCell.Font.Bold = False
'ActiveCell.Font.Bold = False
End Sub

Answer #2    Answered By: Elisa Larson     Answered On: Jan 30

Thanks for the reply
This code  doesnot work form row  10 and onwards
This I noticed later

Answer #3    Answered By: Alessio Smith     Answered On: Jan 30

This one was interesting!
I could not get the inserted  cells or row  to 'set' or 'clear' the formatting
no matter what I did.
Programatically used after inserting  row (or Cells):

Selection.Font.Bold = False
Selection.Font.FontStyle = "Regular"

I wonder if there is a 'seeting' that needs to be 'turned off' that defaults
the cell  formatting to the neighboring or inserted cells? Oh well. What DID
solve the issue by placing a 'value' into the inserted cells, then formatting
them to 'regular' font:

Sub insertrow()
iColumns = ActiveCell.CurrentRegion.Columns.Count
Range(ActiveCell, ActiveCell.Offset(0, iColumns - 1)).Select
Selection.Insert Shift:=xlDown
Selection.Value = "x"
Selection.Font.FontStyle = "Regular"
End Sub

Answer #4    Answered By: Sammy Anderson     Answered On: Jan 30

Not on Excel 2003. The cell  you've made non-bold stays non-bold.

However, neither

> ActiveCell.Font.Bold = False


> ActiveCell.Select
> ActiveCell.Font.Bold = False

is doing what you probably want. They are both acting on the active cell,
which is a single cell. In your case, this will be the same cell that was
active before you pushed the current row  down one.

In the same way that you used EntireRow for the insert, you could use it for
the non-bolding.

ActiveCell.EntireRow.Font.Bold = False

although I don't know whether this marks each cell in the row as having had
its format changed (which would increase the size of the saved workbook).

An alternative is to actually select the column range involved. E.g.:

Range(Cells(ActiveCell.Row, "A"), Cells(ActiveCell.Row, "C")).Font.Bold =

Answer #5    Answered By: Sammy Brown     Answered On: Jan 30

Since you never know when someone will add a column, instead of hard coding "C"
as your last column to format, try the following:

LastUsedColumn = ActiveCell.SpecialCells(xlLastCell).Column
Range(Cells(ActiveCell.Row, "A"), Cells(ActiveCell.Row,
LastUsedColumn)).Font.Bold =

Answer #6    Answered By: Archer Smith     Answered On: Jan 30

I tested the code  on Windows XP, Excel 2003 all the way to Row 65525 with no
problems. What version are you runing?

Didn't find what you were looking for? Find more on Keep cell font bold off Or get search suggestion and latest updates.