2012-09-13 4 views
0

Excel의 모든 워크 시트 문자열을 교체하고 싶습니다.매크로를 사용하여 문자열 바꾸기

여기 모듈입니다. 제가 작성했습니다. 그러나 열 A를 검색 (및 바꾸기) 작업에서 제외하려고합니다.

어떻게해야할지 모르겠습니다. 검색에서 열을 제외 할 수있는 모듈의 변경 사항을 알려주십시오.

감사

Sub FindSignificant() 
    Dim SearchString As String 
    Dim SearchRange As Range, cl As Range 
    Dim FirstFound As String 
    Dim sh As Worksheet 

    ' Set Search value 
    SearchString = "SIGNIFICANT" 
    Application.FindFormat.Clear 
    ' loop through all sheets 
    For Each sh In ActiveWorkbook.Worksheets 
     ' Find first instance on sheet 
     Set cl = sh.Cells.Find(What:=SearchString, _ 
      After:=sh.Cells(1, 1), _ 
      LookIn:=xlFormulas, _ 
      LookAt:=xlPart, _ 
      SearchOrder:=xlByRows, _ 
      SearchDirection:=xlNext, _ 
      MatchCase:=False, _ 
      SearchFormat:=False) 
     If Not cl Is Nothing Then 
      ' if found, remember location 
      FirstFound = cl.Address 
      ' format found cell 
      Do 
       cl.Font.Bold = True 
       cl.Font.ColorIndex = 3 
       ' cl.Interior.ColorIndex = 3 
       ' find next instance 
       Set cl = sh.Cells.FindNext(After:=cl) 
       ' repeat until back where we started 
      Loop Until FirstFound = cl.Address 
     End If 
    Next 
End Sub 

답변

3

이것은 당신의 문제를 해결해야합니다

Do 
    If not cl.column = 1 Then 
    cl.Font.Bold = True 
    cl.Font.ColorIndex = 3 
    ' cl.Interior.ColorIndex = 3    
    End If 
    ' find next instance 
    Set cl = sh.Cells.FindNext(After:=cl) 
    ' repeat until back where we started 
Loop Until FirstFound = cl.Address 
+0

덕분에 많이 :) – Kiran

관련 문제