Hi,
Hope you might be able to help me with this. I have the following code (see below) that effectively concatenates 3 cells (A1, B1 & C1) adding dividers and putting the result into D1. It also applies font bolding to the A1 and C1 bits.
What would the code be to run this macro for all cells 100 rows down; so getting it to enter the results into cells D1 to D100 for all the corresponding values in columns A,B&C?
Many thanks,
C.
Sub Macro1()
Dim Part1Len, Part2Len, DividerLen As Integer
Dim Divider As String
Part1Len = Len(Range("A1")) + 2
Part2Len = Len(Range("B1"))
Part3Len = Len(Range("C1"))
Divider = " - "
DividerLen = Len(Divider)
Range("D1") = "[" & Range("A1") & "]" & Divider & Range("B1") & Divider & Range("C1")
With Range("D1").Characters(Start:=1, Length:=Part1Len).Font
.FontStyle = "Bold"
With Range("D1").Characters(Start:=Part1Len + DividerLen + Part2Len + DividerLen, Length:=Part3Len).Font
.FontStyle = "Bold"
With Range("D1").Characters(Start:=Part1Len + DividerLen + 1, Length:=Part2Len).Font
.FontStyle = "Regular"
End With
End With
End With
End Sub
Hope you might be able to help me with this. I have the following code (see below) that effectively concatenates 3 cells (A1, B1 & C1) adding dividers and putting the result into D1. It also applies font bolding to the A1 and C1 bits.
What would the code be to run this macro for all cells 100 rows down; so getting it to enter the results into cells D1 to D100 for all the corresponding values in columns A,B&C?
Many thanks,
C.
Sub Macro1()
Dim Part1Len, Part2Len, DividerLen As Integer
Dim Divider As String
Part1Len = Len(Range("A1")) + 2
Part2Len = Len(Range("B1"))
Part3Len = Len(Range("C1"))
Divider = " - "
DividerLen = Len(Divider)
Range("D1") = "[" & Range("A1") & "]" & Divider & Range("B1") & Divider & Range("C1")
With Range("D1").Characters(Start:=1, Length:=Part1Len).Font
.FontStyle = "Bold"
With Range("D1").Characters(Start:=Part1Len + DividerLen + Part2Len + DividerLen, Length:=Part3Len).Font
.FontStyle = "Bold"
With Range("D1").Characters(Start:=Part1Len + DividerLen + 1, Length:=Part2Len).Font
.FontStyle = "Regular"
End With
End With
End With
End Sub