:D snasui.com ยินดีต้อนรับ :D
ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย :thup: สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ :arrow: ระบุ Version ของ Excel
:!: โปรดทราบ :!:
  1. กรุณาอ่านกฎการใช้บอร์ด (Forum rules) ในตำแหน่งด้านบนของแต่ละบอร์ด
  2. การสมัครสมาชิก การ Login การกู้คืนรหัสผ่าน
    1. สมัครสมาชิกดูขั้นตอนได้ที่ :arrow: สมัครสมาชิก
    2. Login เข้าระบบโดยคลิกปุ่ม Login ตรงมุมขวาบนของหน้านี้ :roll:
    3. การ Login ผ่าน Facebook ดูวิธีที่ :arrow: Login ผ่าน Facebook
    4. ลืมรหัสผ่านสามารถรับรหัสใหม่ได้ที่ :arrow: Reset รหัสผ่าน
  3. มีปัญหาการใช้งาน แจ้งผู้ดูแลระบบได้ที่ :arrow: ติดต่อผู้ดูแลระบบ
  4. กำหนดการตั้งค่าส่วนตัว เช่นตั้งค่าภาษาเป็นไทยหรืออังกฤษดูได้ที่ :arrow: ตั้งค่าส่วนตัว
  5. การตั้งและตอบกระทู้ดูได้ที่ :arrow: วิธีการตั้งและตอบกระทู้
  6. การจัดรูปแบบตัวอักษรด้วย bbcode ในช่องแสดงความคิดเห็นดูได้ที่ :arrow: จัดรูปแบบตัวอักษร
  7. กำหนดขนาดตัวอักษรใน Browser ดูได้ที่ :arrow: กำหนดขนาดตัวอักษรใน Browser

ReconcileTxn

ฟอรัมถาม-ตอบปัญหาการใช้งานสูตรและฟังก์ชัน Excel
Forum rules
  1. ไม่อนุญาตให้ใช้ภาษาแชทในการถามและตอบปัญหา ไม่ใช้คำว่า "คับ" หรือ "อ่ะครับ" แทนคำว่า "ครับ" ไม่ใช้คำว่า "เด๋ว" แทนคำว่า "เดี๋ยว" เป็นต้น เนื่องจากเมื่อแปลเป็นภาษาต่างประเทศแล้วจะให้ความหมายผิดไปจากที่ควรจะเป็น
  2. ห้ามถามโดยระบุชื่อผู้ตอบและต้องตั้งชื่อกระทู้ให้สื่อถึงปัญหาที่จะถาม ไม่ตั้งชื่อว่า ช่วยด้วยครับ, มีปัญหามาปรึกษาครับ เป็นต้น
  3. กรุณาอธิบายปัญหาและระบุคำตอบที่ต้องการมาในกระทู้ด้วยเสมอถึงแม้จะอธิบายไว้ในไฟล์แนบแล้วก็ตาม ทั้งนี้เพื่ออำนวยความสะดวกแก่เพื่อนสมาชิกในการค้นหาข้อมูล
  4. กรุณาแนบไฟล์ตัวอย่างพร้อมแสดงคำตอบที่ถูกต้องมาในไฟล์ด้วยเพื่อให้ง่ายต่อการทำความเข้าใจและสะดวกต่อการตอบคำถาม (ขนาดไฟล์ไม่เกิน 500Kb ขนาดภาพไม่เกิน 800*600 Pixel) ไม่แนบเป็น Link มาจากแหล่งอื่นที่อาจจะถูกลบทิ้งไปโดยต้นทางในภายหลัง นอกจากนี้ไม่ควรแนบไฟล์ที่มีข้อมูลสำคัญอันก่อให้เกิดความเสียหายกับตนเองและผู้อื่น
  5. กรณีเป็นคำถามเกี่ยวกับ Programming เช่น VBA, VB.Net, C#, SQL ฯลฯ ต้องลองเขียนมาเองก่อนเสมอ ถามเฉพาะที่ติดปัญหา ระบุ Module, Procedure ที่ติดปัญหาให้ชัดเจน กรุณาโพสต์ Code ให้แสดงเป็น Code คือเปิดด้วย [code] และปิดด้วย [/code] ตัวอย่างเช่น [code]dim r as range[/code] เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่าง)
  6. กรุณาแจ้งผลการใช้งานเมื่อได้รับคำตอบว่าตรงกับความต้องการหรือไม่
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

ReconcileTxn

#1

Post by sna »

Hi Dear
I have an issue I need to copy data from sheet Reconcile Txn to Backup Sheet but not empty.
what should I add or edit my code to do that?
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: ReconcileTxn

#2

Post by sna »

Please refer to this template .I also need your help how to clear data more dynamic(Module 1 and 2)


Thanks
You do not have the required permissions to view the files attached to this post.
User avatar
snasui
Site Admin
Site Admin
Posts: 31253
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: ReconcileTxn

#3

Post by snasui »

:D The example code is below:

Code: Select all

Sub CL()
    'RCL2.[A6:Y100].ClearContents
    With RCL2
        .Range("a6:y" & .Range("a" & .Rows.Count).End(xlUp).Row).ClearContents
    End With
End Sub
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: ReconcileTxn

#4

Post by sna »

thank how about copy and paste without blank rows in Module 3?
User avatar
snasui
Site Admin
Site Admin
Posts: 31253
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: ReconcileTxn

#5

Post by snasui »

:D The example code is below:

Code: Select all

With RCL1
    r = [Sumproduct(--('RECONCILE TXN'!b12:b100<>""))]
    .Range("b12:z12").Resize(r).Copy
    RCL4.Range("a1").PasteSpecial xlPasteValues
End With
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: ReconcileTxn

#6

Post by sna »

Thank you 🙏
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: ReconcileTxn

#7

Post by sna »

Code: Select all

Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
    Range("B" & Target.Row).Resize(, 20).Copy Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
End Sub
your code work fine,is it possible like this??
or we can use special cell constant?


Thank you once again
User avatar
snasui
Site Admin
Site Admin
Posts: 31253
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: ReconcileTxn

#8

Post by snasui »

:D It possible to do everything with code. Try with yourself for your task, post the error and attach file to here.
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: ReconcileTxn

#9

Post by sna »

Thank you 🙏
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: ReconcileTxn

#10

Post by sna »

I test
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
Range("B" & Target.Row).Resize(1, 20).Copy RCL4.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
End Sub
it is not working !
User avatar
snasui
Site Admin
Site Admin
Posts: 31253
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: ReconcileTxn

#11

Post by snasui »

:D You need to post code with code style such as post #7.

Attach the updated file that have your latest code inside and explain what you want to do and point to the expected result from your code.
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: ReconcileTxn

#12

Post by sna »

Code: Select all

Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
    Range("B" & Target.Row).Resize(, 20).Copy RCL4.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
End Sub 
I need to copy from RCL1 to RCL4 without empty cells

Best wishes
User avatar
snasui
Site Admin
Site Admin
Posts: 31253
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: ReconcileTxn

#13

Post by snasui »

snasui wrote: Sat Oct 10, 2020 6:58 am Attach the updated file that have your latest code inside and explain what you want to do and point to the expected result from your code.
Please read my post above carefully.
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: ReconcileTxn

#14

Post by sna »

Here's the attached file for your reference

Thanks
You do not have the required permissions to view the files attached to this post.
User avatar
snasui
Site Admin
Site Admin
Posts: 31253
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: ReconcileTxn

#15

Post by snasui »

:D You can call 'CopyNonBlankValue' as below.

Code: Select all

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
'    Range("B" & Target.Row).Resize(, 24).Copy RCL4.Cells(Rows.Count).End(xlUp).Offset(1)
    Call Module3.CopyNonBlankValue
End Sub
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: ReconcileTxn

#16

Post by sna »

Ok.thank will update you
Post Reply