컴퓨터속으로

엑셀의 한 셀내에서 Alt_Enter로 줄 바꾸기한 것들을 엔터값 없애는 방법 없나요?

광명심 2010. 2. 3. 23:49

엑셀의 한 셀내에서 Alt_Enter로 줄바꾸기한것들을 엔터값 없애는 방법 없나요?

해당 시트에 대해 alt+enter를 일괄적으로 변경해주는 VBA를 만들었습니다.

 

VBA삽입법:

1. Alt+F11

2. 좌측 시트목록있는 부분에서 우클릭, 삽입->모듈

3. 생성된 모듈에 아래 코드 붙여넣기

4. 엑셀화면으로 돌아와서 Alt+F8

5. noAltEnter선택

 

'--------------

Sub noAltEnter()
    Dim wn As String
    Dim i, j As Integer
    Dim max_row, max_col As Integer
    wn = Chr(10)
    max_row = ActiveSheet.Cells.SpecialCells(xlLastCell).Row
    max_col = ActiveSheet.Cells.SpecialCells(xlLastCell).Column

    For i = 1 To max_row
        For j = 1 To max_col
            If (InStr(1, Cells(i, j), wn) > 0) Then
                Cells(i, j) = Replace(Cells(i, j), wn, " ")
            Else
            End If
        Next
    Next
End Sub

'------------

출처; http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=102020101&docId=73183419