Making a Cells reference Bold

I

Izran

I'm ashamed I cannot seem to figure out how to make a cells contents
bold when referencing them with the cells function. Here is what I
got:


iRowCountTo = iRowCountTo + 1
Sh2.Cells(iRowCountTo, 1).Value = _
Sh1.Cells(iRowCountFrom, 2).Value
Sh2.Cells(iRowCountTo, 1).Cells.Font.Bold = True
Sh2.Cells(iRowCountTo, 3).Value = _
Sh1.Cells(iRowCountFrom, 3).Value
Sh2.Cells(iRowCountTo, 3).Cells.Font.Bold = True


and I keep getting unable to set hte bold property of the font class.
 
D

Don Guillett

just tested and it worked fine for cells(1,5). where is irowcountto started?
irowcount=irowcount+1
Cells(irowcount, 5).Font.Bold = True
 
I

Izran

Sub Air_Commodity_View()


Dim Sh1 As Worksheet
Dim Sh2 As Worksheet
Dim Sh3 As Worksheet

Dim iRowCountFrom As Integer, iColCountFrom As Integer
Dim iRowCountTo As Integer, iColCountTo As Integer
Dim iColumnCountMMM As Integer


Dim rFromCell As Range
Dim rToCell As Range
Dim rLookupTable As Range
Dim iListMax As Integer


iRowCountTo = 9
iRowCountFrom = 4
iColumnCountTo = 2
iColumnCountFrom = 2


Set Sh1 = Sheets("Air_List")
Set Sh2 = Sheets("Commodity_Entry")
Set Sh3 = Sheets("MMM Index")

Set rLookupTable = Sh3.Range("MMM_TABLE")

Sh2.Range("A10:C65536") = Empty

iListMax = Sheets("Air_List").Range("A1")
For iRowCountFrom = 4 To iListMax + 3
If Not IsEmpty(Sh1.Cells(iRowCountFrom, 2).Value) Then
iRowCountTo = iRowCountTo + 1
Sh2.Cells(iRowCountTo, 1).Value = _
Sh1.Cells(iRowCountFrom, 2).Value
Sh2.Cells(iRowCountTo, 1).Cells.Font.Bold = True
Sh2.Cells(iRowCountTo, 3).Value = _
Sh1.Cells(iRowCountFrom, 3).Value
Sh2.Cells(iRowCountTo, 3).Cells.Font.Bold = True

For iColCountMMM = 4 To 31
If Not IsEmpty(Sh1.Cells(iRowCountFrom, _
iColCountMMM).Value) Then
iRowCountTo = iRowCountTo + 1
Sh2.Cells(iRowCountTo, 2).Value = _
Sh1.Cells(iRowCountFrom, iColCountMMM).Value
Sh2.Cells(iRowCountTo, 3).Value = _
Application.VLookup(Sh1.Cells(iRowCountFrom,
iColCountMMM).Value, rLookupTable, 2, False)
End If
Next iColCountMMM
End If

iRowCountTo = iRowCountTo + 1

Next iRowCountFrom


End Sub
 
I

Izran

I still have the same problem - Runtime Error 1004: Unable to set the
bold property of the font class.
 

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