나는 누군가가 나를 도울 수 있는지 궁금해.기본값 드롭 다운 목록에서
나는 아래에있는 코드를 사용하고 있습니다. 수행중인 여러 작업 중에서 날짜가 "A"로 채워지고 새 레코드가 만들어 질 때 텍스트 값이 "아니요"인 열 "AS"가 자동으로 채워집니다 엑셀 스프레드 시트. 내가 날짜 열 "A"에 삽입 할 때입니다 가능하다면, 어떻게하고 싶은 무엇
Option Explicit
Public preValue As Variant
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range, res As Variant
Dim rCell As Range
Dim Rng1 As Range
Dim Rng2 As Range
Dim Rng3 As Range
Application.EnableCancelKey = xlDisabled
'Sheets("Input").Protect "handsoff", UserInterFaceOnly:=True, AllowFiltering:=True, AllowFormattingColumns:=True
If Target.Column = 3 Then
If Target = "No" Then MsgBox "Please remember to make the same change to all rows for " & Target.Offset(0, -1).Value & " and delete any future forecasts"
End If
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
If Not Intersect(Target, Range("B5:AD400", "AF5:AQ400")) Is Nothing Then
If Target.Value <> preValue And Target.Value <> "" Then
Application.EnableEvents = False
With Rows(Target.Row)
.Range("A1").Value = Date
.Range("AS1").Value = "No"
End With
Application.EnableEvents = True
Target.Interior.ColorIndex = 35
End If
End If
On Error GoTo 0
If Target.Column = 45 Then
If Target.Value = "Yes" Then
Set Rng1 = Application.Union(Cells(Target.Row, "B").Resize(, 19), Cells(Target.Row, "R"))
Rng1.Interior.ColorIndex = xlNone
Set Rng2 = Application.Union(Cells(Target.Row, "S").Resize(, 12), Cells(Target.Row, "AD"))
Rng2.Interior.ColorIndex = 37
Set Rng3 = Application.Union(Cells(Target.Row, "AF").Resize(, 12), Cells(Target.Row, "AQ"))
Rng3.Interior.ColorIndex = 42
End If
End If
If Not Intersect(Target, Range("J7:J400")) Is Nothing Then
Set Cell = Worksheets("Lists").Range("B2:C23")
res = Application.VLookup(Target, Cell, 2, False)
If IsError(res) Then
Range("K" & Target.Row).Value = ""
Else
Range("K" & Target.Row).Value = res
End If
End If
End Sub
, 내가 열에서 같은 행의 "선택"텍스트 값을 삽입하려는 "기음". 이 값은 드롭 다운 메뉴에있는 첫 번째 값에서 가져온 것으로 "RDStaff"라는 이름의 범위가있는 "목록"이라는 시트에 설정됩니다.
누군가가 아마도 기능 변경에 대해 어떻게 생각하는지 말해 주시겠습니까? "A"열에 날짜가 입력되면 내 목록의 첫 번째 값 즉 "Select"가 자동으로 열 " 기음"?
많은 감사와 종류
에 관하여 크리스
'행 (Target.Row). 범위 ("C1"). 값 = "선택"- 필요한 것이 전부가 아닙니까? – mattboy
안녕하세요 @ mattboy, 내 게시물에 회신하는 시간을내어 주셔서 감사합니다. 나는 이것을 시도했지만, 내가 가진 문제는 사용자가 드롭 다운 메뉴에서 "선택"으로 돌아 가지 않고 값을 선택할 수 없다는 것입니다. 많은 감사와 친절 감사합니다 – IRHM