: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

entry accrued

ฟอรัมถาม-ตอบปัญหาการใช้งานสูตรและฟังก์ชัน 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

entry accrued

#1

Post by sna »

Hi Dear!
I create a data entry form for listing accrued expenses in excel but I am stuck how to create serial number after data entry in column B.serial number format letter A and Year 2 digits month 2 digits day 2 digits and "-" and serial 00X(001,002....)
I also don't know why my edit button not working

I attached a template

Thanks
You do not have the required permissions to view the files attached to this post.
User avatar
puriwutpokin
Guru
Guru
Posts: 3801
Joined: Fri Jan 04, 2013 9:49 pm
Location: Bangkok
Excel Ver: MS.365

Re: entry accrued

#2

Post by puriwutpokin »

Try edit

Code: Select all

RecordRow = Application.Match(CStr(TextBox7.Value), Range("Table1[Serial No]"), 0)

Code: Select all

'Other...
    TextBox1.Value = Cells(5, 1).Offset(RecordRow, 1).Value
    TextBox2.Value = Cells(5, 1).Offset(RecordRow, 2).Value
    TextBox3.Value = Cells(5, 1).Offset(RecordRow, 3).Value
    TextBox4.Value = Cells(5, 1).Offset(RecordRow, 4).Value
    TextBox5.Value = Cells(5, 1).Offset(RecordRow, 5).Value
    TextBox6.Value = Cells(5, 1).Offset(RecordRow, 6).Value
'Other...    
:shock: :roll: :D
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: entry accrued

#3

Post by sna »

Thanks but how to create serial like A201222-001
A201222-002
A201222-003
...
In column A with code
Thanks
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: entry accrued

#4

Post by sna »

I try changing it works but show the data we search.I want to click new it will amend the previous data.could you give more code to proceed?


Thanks
User avatar
puriwutpokin
Guru
Guru
Posts: 3801
Joined: Fri Jan 04, 2013 9:49 pm
Location: Bangkok
Excel Ver: MS.365

Re: entry accrued

#5

Post by puriwutpokin »

Modify old code and use button New

Code: Select all

Private Sub CommandButton2_Click()
    Dim RecordRow As Long
    Dim RecordRange As Range
    On Error Resume Next
        RecordRow = Application.Match(CStr(TextBox7.Value), Range("Table1[Serial No]"), 0)
        Set RecordRange = Range("Table1").Cells(5, 1).Offset(RecordRow - 1, 0)
        If Err.Number <> 0 Then
            ErrorLabel.Visible = True
            On Error GoTo 0
            Exit Sub
        End If
    On Error GoTo 0
    ErrorLabel.Visible = False
    Cells(5, 1).Offset(RecordRow, 1).Value = TextBox1.Value
    Cells(5, 1).Offset(RecordRow, 2).Value = TextBox2.Value
    Cells(5, 1).Offset(RecordRow, 3).Value = TextBox3.Value
    Cells(5, 1).Offset(RecordRow, 4).Value = TextBox4.Value
    Cells(5, 1).Offset(RecordRow, 5).Value = TextBox5.Value
    Cells(5, 1).Offset(RecordRow, 6).Value = TextBox6.Value
End Sub
:shock: :roll: :D
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: entry accrued

#6

Post by sna »

How about to create serial number like A201222-001
A201222-002
A201222-003
...


Thanks
User avatar
puriwutpokin
Guru
Guru
Posts: 3801
Joined: Fri Jan 04, 2013 9:49 pm
Location: Bangkok
Excel Ver: MS.365

Re: entry accrued

#7

Post by puriwutpokin »

It Sample Code

Code: Select all

    
'Other code...    
        Rng.Offset(, 5).Value = TextBox6.Value
        Rng.Offset(, -1).Value = Format(TextBox6.Value, "Ayymmdd") & _
        Right(Format(WorksheetFunction.CountA(Range("Table1[Accrued Account]")), "-0000"), 5)
'Other code...   
:shock: :roll: :D
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: entry accrued

#8

Post by sna »

Really appreciate.it works
once more how can we transfer by row as per below:
Expense account to journal sheet in column Debit Acc

Accrued Account to journal sheet in column Credit Account

Amount to journal sheet in column Amount

Class to journal sheet in column Location

Best Regards
User avatar
puriwutpokin
Guru
Guru
Posts: 3801
Joined: Fri Jan 04, 2013 9:49 pm
Location: Bangkok
Excel Ver: MS.365

Re: entry accrued

#9

Post by puriwutpokin »

Try writing code yourself first. What kind And then make a sample of that file I want it.
:shock: :roll: :D
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: entry accrued

#10

Post by sna »

Hi Dear

I need to copy Accrued account, Expense Account and Amount To Journal Sheet.
I draw a shape toward the result I need.
I want to open workbook hide sheetJournal .but when I click JV button on userform it show sheet journal and I can click back to sheet data but hide sheet journal as normal.


Hope you may help


Best Regards,
You do not have the required permissions to view the files attached to this post.
User avatar
puriwutpokin
Guru
Guru
Posts: 3801
Joined: Fri Jan 04, 2013 9:49 pm
Location: Bangkok
Excel Ver: MS.365

Re: entry accrued

#11

Post by puriwutpokin »

Sample code

Code: Select all

Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim lr As Long, i As Long, j As Long
j = 11
        Set ws1 = Worksheets("Data")
        Set ws2 = Worksheets("Journal")
        ws2.Visible = True
        lr = ws1.Range("A" & Rows.Count).End(xlUp).Row
        For i = 6 To lr
       
        If ws1.Cells(i, 1).Value <> "" Then
        ws2.Cells(j, 1).Value = ws1.Cells(i, 1).Offset(, 2).Value
        ws2.Cells(j, 2).Value = ws1.Cells(i, 1).Offset(, 1).Value
        ws2.Cells(j, 4).Value = ws1.Cells(i, 1).Offset(, 3).Value
        j = j + 1
        End If
        Next
     ws2.Visible = False
:shock: :roll: :D
sna
Silver
Silver
Posts: 721
Joined: Tue May 05, 2020 8:18 am
Excel Ver: Excel 365

Re: entry accrued

#12

Post by sna »

Hi when I click JV button it hides journal sheet.
I mean when open workbook journal sheet hide but when click JV button the journal sheet show with value from data sheet.


Hope you got it

note the result in journal would be like the shape I draw on the right


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

Re: entry accrued

#13

Post by sna »

Hi Dear,


I need that way as I open the template.Excel Auto hide Journal Sheet and Show only Data Sheet but when I click Load form then click JV it will copy some data from Data Sheet to Journal Sheet and hide Data Sheet

Thanks
Post Reply