Sub testMax() Dim intStart As Integer: intStart = 5 Dim intEnd As Integer: intEnd = 10 Dim rngMax As Range Set rngMax = Sheets("1일").Range("C" & intStart & ":D" & intEnd) Set rngMax = Sheets("1일").Range("C" & intStart, "D" & intEnd) Set rngMax = Sheets("1일").Range(Cells(intStart, 3), Cells(intEnd, 4))
Range("F3").Value = WorksheetFunction.Max(rngMax) End Sub
안녕하세요? 마리너님~
첨부파일을 자세히 보진 않았습니다만..
아래의 코드를 참고해 보시면 문제가 해결 되실 것 같습니다.
Sub testMax()
Dim intStart As Integer: intStart = 5
Dim intEnd As Integer: intEnd = 10
Dim rngMax As Range
Set rngMax = Sheets("1일").Range("C" & intStart & ":D" & intEnd)
Set rngMax = Sheets("1일").Range("C" & intStart, "D" & intEnd)
Set rngMax = Sheets("1일").Range(Cells(intStart, 3), Cells(intEnd, 4))
Range("F3").Value = WorksheetFunction.Max(rngMax)
End Sub
정리하자면..
아래 3개의 표현은 모두 동일한 셀영역을 표시하는 방법입니다.
Cells를 사용할때는 Cells(행숫자,열숫자) 인 것에 주의 하세요..
Rnage("C5:D10")
Rnage("C5","D10")
Range(Cells(5,3),Cells(10,4))
** 참고로.. [긴급] 같은 것은 적으셔도 아무 소용이 없습니다. 하하..