Tim Hanson
Member
I am trying to combine these two macros so that I can call the 2nd macro by header names in the 1st macro.
Not getting it.
Thanks
Not getting it.
Thanks
Code:
Sub fmt()
ColList = "Field1,Field2,Field3,Field4"
ColArray = Split(ColList, ",")
Set colToFormat = Nothing
For Each Heading In ColArray
Set headingFound = Range("A:A").Offset(0, ActiveSheet.Cells.Find(What:=Heading, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Column - 2)
If colToFormat Is Nothing Then Set colToFormat = headingFound Else Set colToFormat = Union(colToFormat, headingFound)
Next
Call RemoveCharList(char As Variant)
End Sub
Code:
Sub RemoveCharList(char As Variant)
Dim char As Variant, x As Variant
Dim LR As Long, i As Long, j As Long
char = Array("]", "{", "%") ' Change this to suit
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
With Range("I" & i)
x = Split(.Value)
For j = LBound(char) To UBound(char)
x(UBound(x)) = Replace(x(UBound(x)), char(j), vbNullString)
Next
.Value = Join(x)
End With
Next i
End Sub