M
MiataDiablo
I'm using the following code to run through a column (F) combining
contents of two other columns and change font characteristics of the
first couple of characters. I have since created a form that allows
the user to enter information. When I click OK on my user form that
enters all of the info, I would like to call a macro that performs the
same thing but only on the row just added. Seems simple enough but I
can't seem to get my head around it. Any help is greatly appreciated.
Columns("F:F").Select
With Selection.Font
..Name = "Times New Roman"
..FontStyle = "Regular"
..Size = 11
End With
With ActiveSheet
r = ActiveSheet.Cells(.Rows.Count, 2).End(xlUp).Row
End With
For i = 2 To r
If IsEmpty(Cells(i, 4)) = True Then
Cells(i, 6).Value = Cells(i, 5).Value
With Cells(i, 6).Characters(Start:=1, Length:=3).Font
..FontStyle = "Bold"
End With
Else
Cells(i, 6).Value = Cells(i, 4).Value & ": " & Cells(i, 5).Value
With Cells(i, 6).Characters(Start:=1, Length:=2).Font
..FontStyle = "Bold"
End With
With Cells(i, 6).Characters(Start:=1, Length:=3).Font
..Size = 8
End With
End If
Next
Range("F1").Select
Selection.Font.Bold = True
End Sub
contents of two other columns and change font characteristics of the
first couple of characters. I have since created a form that allows
the user to enter information. When I click OK on my user form that
enters all of the info, I would like to call a macro that performs the
same thing but only on the row just added. Seems simple enough but I
can't seem to get my head around it. Any help is greatly appreciated.
Columns("F:F").Select
With Selection.Font
..Name = "Times New Roman"
..FontStyle = "Regular"
..Size = 11
End With
With ActiveSheet
r = ActiveSheet.Cells(.Rows.Count, 2).End(xlUp).Row
End With
For i = 2 To r
If IsEmpty(Cells(i, 4)) = True Then
Cells(i, 6).Value = Cells(i, 5).Value
With Cells(i, 6).Characters(Start:=1, Length:=3).Font
..FontStyle = "Bold"
End With
Else
Cells(i, 6).Value = Cells(i, 4).Value & ": " & Cells(i, 5).Value
With Cells(i, 6).Characters(Start:=1, Length:=2).Font
..FontStyle = "Bold"
End With
With Cells(i, 6).Characters(Start:=1, Length:=3).Font
..Size = 8
End With
End If
Next
Range("F1").Select
Selection.Font.Bold = True
End Sub