programing

Excel VBA - 코드에서 셀 값 읽기

telebox 2023. 8. 15. 11:01
반응형

Excel VBA - 코드에서 셀 값 읽기

Excel에서 전자 메일을 보내는 작업입니다.다음은 예제 열입니다.루프에서 이메일 값을 가져오려면 어떻게 해야 합니까?감사해요.

enter image description here

내 코드는 다음과 같습니다.

범위로 조광범위로 행 조임범위로 조광 셀내 날짜를 날짜로 표시DimmyDiff As Long

설정 rg = 범위("E5:E17")설정 rng2 = 범위("F5:F17")Dim cell2 As 범위

Dimi As 정수i = 5

각 행 Inng에 대해.열에 있는 각 셀에 대해. 셀

MsgBox cell.Value
mydate = cell.Value
myDiff = DateDiff("d", Date, mydate)

Set rng2 = Range("F" & i)
For Each cell2 In rng2
 MsgBox cell2.Value
Next cell2

If myDiff > -8 And myDiff < 8 그렇다면전자 메일보내세요종료할 경우

i = i + 1다음 셀다음 행

당신은 이것이 필요할 것 같습니다.

Dim n as Integer   

For n = 5 to 17
  msgbox cells(n,3) '--> sched waste
  msgbox cells(n,4) '--> type of treatm
  msgbox format(cells(n,5),"dd/MM/yyyy") '--> Lic exp
  msgbox cells(n,6) '--> email col
Next

언급URL : https://stackoverflow.com/questions/17584531/excel-vba-read-cell-value-from-code

반응형