snasui.com ยินดีต้อนรับ
ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
ฟอรัมถาม-ตอบปัญหาการใช้งาน Macro และ VBA
Forum rules
ไม่อนุญาตให้ใช้ภาษาแชทในการถามและตอบปัญหา ไม่ใช้คำว่า "คับ" หรือ "อ่ะครับ" แทนคำว่า "ครับ" ไม่ใช้คำว่า "เด๋ว" แทนคำว่า "เดี๋ยว" เป็นต้น เนื่องจากเมื่อแปลเป็นภาษาต่างประเทศแล้วจะให้ความหมายผิดไปจากที่ควรจะเป็น
ห้ามถามโดยระบุชื่อผู้ตอบและต้องตั้งชื่อกระทู้ให้สื่อถึงปัญหาที่จะถาม ไม่ตั้งชื่อว่า ช่วยด้วยครับ, มีปัญหามาปรึกษาครับ เป็นต้น
กรุณาอธิบายปัญหาและระบุคำตอบที่ต้องการมาในกระทู้ด้วยเสมอถึงแม้จะอธิบายไว้ในไฟล์แนบแล้วก็ตาม ทั้งนี้เพื่ออำนวยความสะดวกแก่เพื่อนสมาชิกในการค้นหาข้อมูล
กรุณาแนบไฟล์ตัวอย่างพร้อมแสดงคำตอบที่ถูกต้องมาในไฟล์ด้วยเพื่อให้ง่ายต่อการทำความเข้าใจและสะดวกต่อการตอบคำถาม (ขนาดไฟล์ไม่เกิน 500Kb ขนาดภาพไม่เกิน 800*600 Pixel) ไม่แนบเป็น Link มาจากแหล่งอื่นที่อาจจะถูกลบทิ้งไปโดยต้นทางในภายหลัง นอกจากนี้ไม่ควรแนบไฟล์ที่มีข้อมูลสำคัญอันก่อให้เกิดความเสียหายกับตนเองและผู้อื่น
กรณีเป็นคำถามเกี่ยวกับ Programming เช่น VBA, VB.Net, C#, SQL ฯลฯ ต้องลองเขียนมาเองก่อนเสมอ ถามเฉพาะที่ติดปัญหา ระบุ Module, Procedure ที่ติดปัญหาให้ชัดเจน กรุณาโพสต์ Code ให้แสดงเป็น Code คือเปิดด้วย [code] และปิดด้วย [/code] ตัวอย่างเช่น [code]dim r as range[/code] เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่าง)
กรุณาแจ้งผลการใช้งานเมื่อได้รับคำตอบว่าตรงกับความต้องการหรือไม่
sna
Silver
Posts: 721 Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365
#1
Post
by sna » Sun Sep 18, 2022 10:34 pm
Hello code experts
If you press the button in the conditions sheet, a new sheet is created by the name of portal.
In this workbook, the 2B sheet containing the same Invoice Number have different amount values in column J K L M and N. The amount values of J K L and M are combined in one row and displayed in Portal sheet. I want to combine the values of column N also and display in the Portal sheet. For that, I need your expertise and help to to edit the code to get the combined value of N in the portal sheet.
Tks
Attachments
Get cess sum 2B.xlsm
(46.89 KiB) Downloaded 8 times
snasui
Site Admin
Posts: 31205 Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:
#2
Post
by snasui » Mon Sep 19, 2022 9:21 pm
Change this statement
Code: Select all
dic(id) = s(0) & "|" & s(1) & "|" & s(2) & "|" & s(3) & "|" & s(4) & "|" & _
s(5) & "+" & cell.Offset(0, 8) & "|" & s(6) + cell.Offset(0, 9) & "|" & _
s(7) + cell.Offset(0, 10) & "|" & s(8) + cell.Offset(0, 11) & "|" & _
s(9) + cell.Offset(0, 12) & "|" & s(10) & "|" & s(11) & "|" & _
s(12) & "|" & s(13) & "|" & s(14) & "|"
to
Code: Select all
dic(id) = s(0) & "|" & s(1) & "|" & s(2) & "|" & s(3) & "|" & s(4) & "|" & _
s(5) & "+" & cell.Offset(0, 8) & "|" & s(6) + cell.Offset(0, 9) & "|" & _
s(7) + cell.Offset(0, 10) & "|" & s(8) + cell.Offset(0, 11) & "|" & _
s(9) + cell.Offset(0, 12) & "|" & s(10) + cell.Offset(0, 13) & "|" & s(11) & "|" & _
s(12) & "|" & s(13) & "|" & s(14) & "|"
sna
Silver
Posts: 721 Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365
#3
Post
by sna » Tue Sep 20, 2022 6:31 am
thank you