snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Dim DrugRange As Range
Dim LotRange As Range
Dim FillLot As Range
Dim i As Range
Set DrugRange = Range("List!B:F")
Set LotRange = Range("List!F:F")
Set FillLotRange = Range("FillForm!C8")
i = Application.WorksheetFunction.Index(DrugRange, Match(FillLotRange, LotRange, 0))
With Sheets("List")
.Range("i").Value = _
Sheets("FillForm").Range("C12").Value
End With
You do not have the required permissions to view the files attached to this post.
On Error Resume Next
Dim FillLotRange As Range
Dim LotRange As Range
Dim i As Range
Set LotRange = Range("List!B:B")
Set FillLotRange = Range("FillForm!C8")
With Application.WorksheetFunction
Set i = Sheets("List").Range("F" & .Match(FillLotRange, LotRange, 0))
End With
With Sheets("List")
i.Value = Sheets("FillForm").Range("C12").Value
End With
On Error Resume Next
Dim FillCodeRange As Range
Dim CodeRange As Range
Dim i As Range
Set CodeRange = Range("List!B:B")
Set FillCodeRange = Range("FillForm!C8")
With Application.WorksheetFunction
Set i = Sheets("List").Range("C:F" & .Match(FillCodeRange, CodeRange, 0))
End With
With Sheets("List")
i.Value = Sheets("FillForm").Range("c4:f4").Value
End With
ลองเป็นแบบนี้มันใช้ไม่ได้ค่ะ
You do not have the required permissions to view the files attached to this post.
'Other code
Dim i As Integer
Set CodeRange = Range("List!B:B")
Set FillCodeRange = Range("FillForm!C8")
With Application.WorksheetFunction
i = .Match(FillCodeRange, CodeRange, 0)
End With
With Sheets("List")
.Range("c" & i).Resize(1, 4).Value = Sheets("FillForm").Range("c4:f4").Value
End With
'Other code