Making a Cells reference Bold

  • Thread starter Thread starter Izran
  • Start date Start date
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.
 
just tested and it worked fine for cells(1,5). where is irowcountto started?
irowcount=irowcount+1
Cells(irowcount, 5).Font.Bold = True
 
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 still have the same problem - Runtime Error 1004: Unable to set the
bold property of the font class.
 
Back
Top