2014-12-05 2 views
0
For i = 1 To 5 
    changeto = CStr(Sheet15.Cells(1, i).Formula) 
    newindustry = getfirstword(Worksheets("Industry Insert Template").Range("C1")) 
    'grab the index position of the comma and exclamation mark 
    intchangeto = InStr(changeto, ",") 
    finalchangeto = InStr(changeto, "!") 
    'extract the worksheet substring 
    finalindustry = Mid(changeto, intchangeto + 1, finalchangeto - intchangeto - 1) 

    If finalindustry <> "'Multiples & EPS'" And finalindustry <> "Technicals" Then 
     finalformula = Replace(changeto, finalindustry, newindustry) 
     Cells(1, i).Formula = finalformula 
    End If 
Next 

현재 워크 시트 이름을 조정하는 것이 내 매크로입니다.
수치 참조 만 조정하고 싶습니다. 예를 들어
수식 VBA의 숫자 참조 바꾸기?

:

I가 정확한 열을 반영 VLOOKUP의 셀 (41)을 변경할 수 있도록 할
=VLOOKUP($B1,Industrials!$CA$41:$GG$41,C$8) 

.
어떻게 모든 세포를 통과하고 이것을 반영하는 공식을 바꿀까요?

+0

더 나은 오래된 행의 장소에서 사용할 수 있습니다 명명 된 범위를 사용합니다. 그것이 그들이있는 곳입니다. – ja72

+0

R1C1 스타일 주소 지정을 사용하여 살펴볼 수 있습니다. VBA에서'.FormulaR1C1'을 사용하여 액세스했습니다. – Captain

답변

0

사용 교체 :

예 :

Cells (1, i).Formula = Replace(Cells (1, i).Formula, oldRow, NewRow) 

만약 i의 값이 행 번호에 관련되어, 당신의 등