Page 1 of 1

Macro : ไม่ต้องการให้โชว์ค่าที่เป็น - และ include

Posted: Wed Oct 09, 2019 10:55 am
by wisitsakbenz
รบกวนอาจารย์ครับ ถ้าไม่ต้องการให้โชว์ค่าที่เป็น - และ include และเว้นบรรทัดในแต่ละหัวข้อด้วยครับ

ต้องปรับ Code อย่างไรบ้างครับ ขอบคุณครับ

Re: Macro : ไม่ต้องการให้โชว์ค่าที่เป็น - และ include

Posted: Wed Oct 09, 2019 8:14 pm
by snasui
:D กรณีเป็นคำถามที่ต่อเนื่องจากกระทู้เดิม ให้ถามในกระทู้นั้น ไม่ควรเปิดกระทู้ใหม่ จะได้สะดวกในการติดตามและสะดวกต่อการเรียนรู้ของเพื่อนสมาชิก

กรุณาเขียน Code สำหรับสิ่งที่ถามมาเองก่อน ติดแล้วค่อยถามกันครับ

Re: Macro : ไม่ต้องการให้โชว์ค่าที่เป็น - และ include

Posted: Thu Oct 10, 2019 8:45 am
by wisitsakbenz
ขอโทษครับอาจารย์

อาจารย์ครับผมได้ลองเขียน Code แล้วมันลบได้แล้ว แต่จะเหลือช่องว่างไว้ อยากให้เหลือแค่ช่องว่างแค่ 1 row ครับ
ไม่ทราบว่าต้องแก้ Code ตรงไหนบ้างครับ
รบกวนอาจารย์ด้วยครับ ขอบคุณครับ

Re: Macro : ไม่ต้องการให้โชว์ค่าที่เป็น - และ include

Posted: Thu Oct 10, 2019 1:29 pm
by wisitsakbenz
ตอนนี้ได้แล้วนะครับอาจารย์ แต่อยากให้มีช่องว่างก่อนจะขึ้นหัวข้อใหม่ ไม่ทราบว่าต้องแก้ Code ตรงไหนบ้างครับ

Re: Macro : ไม่ต้องการให้โชว์ค่าที่เป็น - และ include

Posted: Thu Oct 10, 2019 2:15 pm
by wisitsakbenz
ได้แล้วครับ อาจารย์ snasui ขอบคุณมากครับ

Re: Macro : ไม่ต้องการให้โชว์ค่าที่เป็น - และ include

Posted: Thu Oct 10, 2019 6:04 pm
by wisitsakbenz
ขอโทษด้วยครับอาจารย์ ยังไม่ได้ครับ มองผิด

รบกวนอาจารย์ด้วยครับ ขอบคุณครับ

Re: Macro : ไม่ต้องการให้โชว์ค่าที่เป็น - และ include

Posted: Thu Oct 10, 2019 9:00 pm
by snasui
:D ตัวอย่างการปรับ Code ครับ

Code: Select all

'Other code
Dim t As Variant
 
HeadingRow = WF.Range("FormsFirstLine").Row
CurrentRow = HeadingRow

For Each AmountCell In WI.Range("InputHospitalCharges").Cells
    If AmountCell <> "" And AmountCell <> "Include" And AmountCell <> "0" Then
        WF.Cells(HeadingRow, 1) = "Hospital Charges"
        WF.Cells(HeadingRow, 1).Font.Bold = True
        WF.Cells(HeadingRow, 1).Font.Underline = True
        WF.Cells(HeadingRow, 5) = ""
        CurrentRow = CurrentRow + 1
        WF.Cells(CurrentRow, 1) = AmountCell.Offset(0, -2)
        WF.Cells(CurrentRow, 1).Font.Underline = False
        WF.Cells(CurrentRow, 5) = AmountCell.Text
        If InStr(WF.Cells(CurrentRow, 1), "Package") Then
            l = l + 1
            t = WF.Cells(CurrentRow, 1).Resize(1, 5)
            WF.Cells(CurrentRow, 1).Resize(1, 5).Value = _
                WF.Cells(HeadingRow + l, 1).Resize(1, 5).Value
            WF.Cells(HeadingRow + l, 1).Resize(1, 5).Value = t
        End If
    End If

Next
            
If HeadingRow <> CurrentRow Then HeadingRow = CurrentRow + 2
CurrentRow = HeadingRow

l = 0
'Other code

Re: Macro : ไม่ต้องการให้โชว์ค่าที่เป็น - และ include

Posted: Fri Oct 11, 2019 8:41 am
by wisitsakbenz
ได้แล้วครับ อาจารย์ snasui ขอบคุณมากครับ