매크로를 사용하여 선택한 셀 범위에 서식을 추가하고 있습니다. (Excel 2007) 선택한 범위의 열과 행 수는 항상 다릅니다. 또한 선택한 영역이 항상 같은 워크 시트에있는 것은 아닙니다.선택한 매크로 범위의 마지막 두 번째 행에 서식을 적용하는 Excel 매크로
매크로를 기록하고 코드를 약간 변경했지만, 선택한 범위의 끝에서 두 번째 행의 셀에 서식을 적용 할 수있는 방법을 알아낼 수 없었습니다.이 경우 두 줄 밑줄 .
Sub feladat()
Application.ScreenUpdating = False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.Weight = xlThin
End With
Selection.SpecialCells(xlCellTypeFormulas, 23).Select
Selection.Font.Bold = True
Application.ScreenUpdating = True
End Sub
I 오프셋을 사용하여 끝에서 두 번째 행을 발견했지만, 현재 셀은 항상 다른 장소에있는 매크로를 실행 한 후 이후 행운과 함께했습니다.
고마워요! 오늘 저는 새로운 것을 배웠습니다 :). – vargap
통합 문서의 워크 시트에서 작업하고 Selection.Rows.Count 뒤에 "-2"를 넣으려면 코드를 약간 조정했는데 그렇지 않으면 완벽하게 작동합니다! – vargap
:) 듣기에 행복합니다! – Noldor130884