snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Hi, all
Thank you for your response ChoBkuN that's very helpfull, I'm glad to c the answer for resolve this
but, i just need to improve that, how can i the fastest way to calculation this millage like:
Example : when i type data in sheet IT760 (166336 to 166366= 30 km this cost for user xxx xxx xxxxxx)
everything link automatically and all IT Grant total every sheet must be summaries @ sheet SUMMARY NO(Kilometer).
เวลาทีเราคียจช้มูนใส ให้ทุกอย่างมัน link ไปเอง หลือ จะมี Macro ที่ทำหน้าที่ทุกอย่างเลีย
I want to try answering before Sen' Se'.
In my oppinion.
1. You have to design every sheet as the same table. That it will easy to write formular to summary product from all sheet.
2. And have to delete "Grand total" Column to prevent from summary same product double time. Or move it to another column that's not the same of your data.
3. In this case, I advice you to use "Sumproduct" function to solve this problem krub.
4. Another thing is Rewrite your Refference column to be form as the name sheet. (IT 116 to IT116 "Delete Space")
If you see the attach file below. I have changed somthing in table for easy to write the formular.
For more easier to use. You can redesign it as you want. But don't write any thing as the same of your sheet data. That'll be inturruped the formular.
You do not have the required permissions to view the files attached to this post.
Delete column "A" on sheet IT116 for shift your data to the same column of other sheets.
Sheet "SUMMARY NO(Kilometre)." cell I4 enter this formula.
=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,IF($A4<>"",LOOKUP(2,1/($A4=INDIRECT("'"&SUBSTITUTE(I$3," ","")&"'!A4:A110")),INDIRECT("'"&SUBSTITUTE(I$3," ","")&"'!I4:I110")))))
Enter > Copy across then down.
If you clear space in all fields in "I3:Q3" on sheet "SUMMARY NO(Kilometre)." the formula above can replace with this formula.
Sub Get_Data()
Dim rSource As Variant
Dim rTarget As Range
Dim i As Integer
Sheets("SUMMARY NO(Kilometre).").Range("A70:I" & Rows.Count).Clear
Sheets("SUMMARY NO(Kilometre).").Range("A70") = "Start"
rSource = Array(Sheets("IT116").Range("K7:R25"), _
Sheets("IT760").Range("A54:I71"), _
Sheets("IT134").Range("A47:I63"), _
Sheets("IT1272").Range("A50:I69"), _
Sheets("IT1500").Range("A51:I75"), _
Sheets("IT443").Range("A46:I58"), _
Sheets("IT835").Range("A44:I56"), _
Sheets("IT135").Range("A44:I55"), _
Sheets("IT148").Range("A30:I33"))
For i = 0 To UBound(rSource)
Set rTarget = Sheets("SUMMARY NO(Kilometre).").Range("A" & Rows.Count) _
.End(xlUp).Offset(1, 0)
rSource(i).Copy rTarget
Next i
End Sub
Sub RemoveDup()
Dim r As Range
Dim i As Integer
Dim iCount As Integer
With Sheets("SUMMARY NO(Kilometre).")
Set r = .Range("A71")
i = .Range("A" & Rows.Count).End(xlUp).Row
End With
iCount = 1
Do While iCount <= i
If Application.CountIf(r.Resize(iCount) _
, r(iCount)) > 1 Then
r(iCount).EntireRow.Delete
Else
iCount = iCount + 1
End If
Loop
End Sub