풍기한우프라자 생산집계표
쇼핑몰관리자
2013-12-31 12:40
4,320
0
본문
Sub RemoveExternalLinks_Safe()
Dim c As Range
Dim ws As Worksheet
Dim formulaText As String
Dim startPos As Long, endPos As Long
Dim fileRef As String
For Each ws In ThisWorkbook.Sheets
For Each c In ws.UsedRange
If c.HasFormula Then
formulaText = c.Formula
If InStr(formulaText, "[") > 0 Then
' 외부참조 파일 경로만 제거 (예: '[입금내역.xlsx]Sheet1' → 'Sheet1')
Do While InStr(formulaText, "[") > 0 And InStr(formulaText, "]") > 0
startPos = InStr(formulaText, "[")
endPos = InStr(formulaText, "]")
If endPos > startPos Then
fileRef = Mid(formulaText, startPos, endPos - startPos + 1)
formulaText = Replace(formulaText, fileRef, "")
Else
Exit Do
End If
Loop
c.Formula = formulaText
End If
End If
Next c
Next ws
MsgBox "외부 참조 파일 경로가 정확히 제거되었습니다."
End Sub
댓글목록0