프로그램 관련/기타
Excel 특정 단어 검색후 위에 행삽입 ( 매크로 )
SeoHW
2021. 10. 26. 10:59
반응형
Sub 특정단어검색()
Cells.Find(What : = "특정단어", After : = ActiveCell, LookIn :=xFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirectin:=xlNext, _
MatchCase:=False, MatchByte:=False, SearchFormat:=False).Activate
Selection.EntireRow.Insert, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.FormulaR1C1 = "합계"
Set Rng = Range(ActiveCell.Address)
Rng.Offset(0,1).Select '//오른쪽으로이동
ActiveCell.FormulaR1C1 = "=SUM(B2:R[-1]C)" '//합계
ActiveWindow.SmallScroll Down:=-1
Cells.Replace What:="'B2'", Replacement:="B2", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'// B2에 "" 가붙으므로 제거
End Sub
반응형