vba(하단에 첨부)로 특정 라인에 "(재)책정요청, 중지요청, 제외요청" 이 있으면 그 라인에만 파랑, 빨강,빨강이 칠해지게 만들었습니다.

그래서 엑셀표 상에서는 색상이 잘 입혀집니다.

 

다만, 문제가 있다면

이걸 회사에서 쓰는 프로그램에 붙여넣기를 하면 글꼴색이 붙여넣기가 안되네요..

 

(엑셀표) al43:al65 에는 이런식으로 결과값이 작성되어있는데

이거를 회사에서 쓰는 프로그램에 붙여넣기 하면

 

  밑에내용은 색깔이 안불러와집니다! ㅎㅎㅎㅎ

 

이게 동적으로 내용이 계속 바뀌는 표라서 vba를 설정해둔건데 그러네요..

근데 또 수기로 글자색깔 드래그해서 복붙하면 또 글자에 색깔이 먹혀요.....

어떤게 문제일가요!!!

 

 

 

Sub AL열색상적용()

Dim ws As Worksheet
Dim cell As Range
Dim lines() As String
Dim lineText As String
Dim currentPos As Integer
Dim i As Integer

Set ws = ActiveSheet

For Each cell In ws.Range("AL41:AL65")

If Len(cell.Value) > 0 Then

lines = Split(cell.Value, vbLf)
currentPos = 1

For i = LBound(lines) To UBound(lines)

lineText = lines(i)

If Len(lineText) > 0 Then

On Error Resume Next

cell.Characters(currentPos, Len(lineText)).Font.Color = RGB(0, 0, 0)

If InStr(lineText, "제외요청") > 0 Or _
InStr(lineText, "중지요청") > 0 Then
cell.Characters(currentPos, Len(lineText)).Font.Color = RGB(255, 0, 0)

ElseIf InStr(lineText, "재책정요청") > 0 Or _
InStr(lineText, "책정요청") > 0 Then
cell.Characters(currentPos, Len(lineText)).Font.Color = RGB(0, 0, 255)

End If

On Error GoTo 0

End If

currentPos = currentPos + Len(lineText) + 1

Next i

End If

Next cell

End Sub