Excel에서 인접한 셀이 업데이트되면 셀에 날짜를 자동으로 채우는 방법은 무엇입니까?
때로는 특정 열의 셀을 업데이트 할 때 업데이트에 대한 최신 날짜를 표시 할 수 있습니다. 이 기사에서는이 문제를 해결하기 위해 VBA 방법을 권장합니다. 셀이 업데이트되면 인접한 셀이 즉시 현재 날짜로 자동 채워집니다.
인접 셀이 VBA 코드로 업데이트되면 셀의 현재 날짜 자동 채우기
인접 셀이 VBA 코드로 업데이트되면 셀의 현재 날짜 자동 채우기
업데이트해야하는 데이터가 B 열에 있고 B 열의 셀이 업데이트되면 현재 날짜가 A 열의 인접한 셀에 채워 진다고 가정합니다. 스크린 샷 참조 :
다음 VBA 코드를 실행하여이 문제를 해결할 수 있습니다.
1. 인접한 업데이트 된 셀을 기준으로 날짜를 자동으로 채우는 데 필요한 시트 탭을 마우스 오른쪽 단추로 클릭 한 다음 코드보기 오른쪽 클릭 메뉴에서.
2. Microsoft Visual Basic for Applications 창에서 아래 VBA 코드를 복사하여 코드 창에 붙여 넣으십시오.
VBA 코드 : 인접 셀이 업데이트되면 셀의 현재 날짜 자동 채우기
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'Updated by Extendoffice 2017/10/12
Dim xRg As Range, xCell As Range
On Error Resume Next
If (Target.Count = 1) Then
If (Not Application.Intersect(Target, Me.Range("B:B")) Is Nothing) Then _
Target.Offset(0, -1) = Date
Application.EnableEvents = False
Set xRg = Application.Intersect(Target.Dependents, Me.Range("B:B"))
If (Not xRg Is Nothing) Then
For Each xCell In xRg
xCell.Offset(0, -1) = Date
Next
End If
Application.EnableEvents = True
End If
End Sub
노트:
1). 코드에서 B : B는 업데이트 된 데이터가 B 열에 있음을 의미합니다.
2). -1은 현재 날짜가 B 열의 왼쪽 한 열에 채워짐을 나타냅니다. 현재 날짜를 C 열에 채우려면 -1을 1로 변경하십시오.
3. 프레스 다른 + Q 닫는 동시에 키 응용 프로그램 용 Microsoft Visual Basic 창.
이제부터 B 열의 셀을 업데이트하면 A 열의 인접한 셀이 즉시 현재 날짜로 채워집니다. 스크린 샷보기 :
관련 기사 :
최고의 사무 생산성 도구
🤖 | Kutools AI 보좌관: 다음을 기반으로 데이터 분석을 혁신합니다. 지능형 실행 | 코드 생성 | 사용자 정의 수식 만들기 | 데이터 분석 및 차트 생성 | Kutools 기능 호출... |
인기 기능: 중복 항목 찾기, 강조 표시 또는 식별 | 빈 행 삭제 | 데이터 손실 없이 열이나 셀 결합 | 수식없이 반올림 ... | |
슈퍼 조회: 다중 기준 VLookup | 다중 값 VLookup | 여러 시트에 걸친 VLookup | 퍼지 조회 .... | |
고급 드롭다운 목록: 드롭다운 목록을 빠르게 생성 | 종속 드롭다운 목록 | 다중 선택 드롭 다운 목록 .... | |
열 관리자: 특정 개수의 열 추가 | 열 이동 | Toggle 숨겨진 열의 가시성 상태 | 범위 및 열 비교 ... | |
특색 지어진 특징: 그리드 포커스 | 디자인보기 | 큰 수식 바 | 통합 문서 및 시트 관리자 | 리소스 라이브러리 (자동 텍스트) | 날짜 선택기 | 워크 시트 결합 | 셀 암호화/해독 | 목록으로 이메일 보내기 | 슈퍼 필터 | 특수 필터 (굵게/기울임꼴/취소선 필터링...) ... | |
상위 15개 도구 세트: 12 본문 도구 (텍스트 추가, 문자 제거,...) | 50+ 거래차트 유형 (Gantt 차트,...) | 40+ 실용 방식 (생일을 기준으로 나이 계산,...) | 19 삽입 도구 (QR 코드 삽입, 경로에서 그림 삽입,...) | 12 매출 상승 도구 (숫자를 단어로, 환율,...) | 7 병합 및 분할 도구 (고급 결합 행, 셀 분할,...) | ... 그리고 더 |
Excel용 Kutools로 Excel 기술을 강화하고 이전과는 전혀 다른 효율성을 경험해 보세요. Excel용 Kutools는 생산성을 높이고 시간을 절약하기 위해 300개 이상의 고급 기능을 제공합니다. 가장 필요한 기능을 얻으려면 여기를 클릭하십시오...
Office Tab은 Office에 탭 인터페이스를 제공하여 작업을 훨씬 쉽게 만듭니다.
- Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
- 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
- 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Sort comments by
#44731
This comment was minimized by the moderator on the site
0
0
#43391
This comment was minimized by the moderator on the site
Report
0
0
#43412
This comment was minimized by the moderator on the site
Report
0
0
#43251
This comment was minimized by the moderator on the site
Report
0
0
#43275
This comment was minimized by the moderator on the site
Report
0
0
#40819
This comment was minimized by the moderator on the site
0
0
#40866
This comment was minimized by the moderator on the site
Report
0
0
#40949
This comment was minimized by the moderator on the site
0
0
#40960
This comment was minimized by the moderator on the site
Report
0
0
#40972
This comment was minimized by the moderator on the site
0
0
#41368
This comment was minimized by the moderator on the site
Report
0
0
#38388
This comment was minimized by the moderator on the site
Report
0
0
#38314
This comment was minimized by the moderator on the site
0
0
#38389
This comment was minimized by the moderator on the site
Report
0
0
#37794
This comment was minimized by the moderator on the site
0
0
#37749
This comment was minimized by the moderator on the site
0
0
#37750
This comment was minimized by the moderator on the site
Report
0
0
#34594
This comment was minimized by the moderator on the site
0
0
#34119
This comment was minimized by the moderator on the site
Report
0
0
#34120
This comment was minimized by the moderator on the site
Report
0
0
There are no comments posted here yet