Page 1 of 1

Sheets Array ทำงานแค่แผ่นงานเดียว

Posted: Fri Oct 20, 2017 12:18 am
by yangkodza

Code: Select all

Sub ตั้งค่าเนื้อหา()
    Dim rng As Range
    Application.ScreenUpdating = False
              Sheets(Array("C1T1", "C2T1", "C3T1", "C4T1", "C5T1")).Select
        Set rng = Range("E7:X57,AB8:AC57,AG8:AG57,AJ8:AK57")
       rng.Borders.LineStyle = xlContinuous
        rng.Font.Name = "Angsana New"
        rng.Font.Size = 14
        rng.HorizontalAlignment = xlCenter
        rng.Borders(xlInsideHorizontal).LineStyle = xlContinuous
        Application.ScreenUpdating = True
    End Sub
ทำไม Sheets Array ทำงานแค่ C1T1 แต่แผ่นงานอื่นไม่ยอมทำตามด้วย
ขอคำชี้แนะด้วยครับ :flw:
Sheets Array.xlsm

Re: Sheets Array ทำงานแค่แผ่นงานเดียว

Posted: Fri Oct 20, 2017 6:40 am
by snasui
:D ตัวอย่าง Code ครับ

Code: Select all

Dim rng As Range
Application.ScreenUpdating = False
Sheets(Array("C1T1", "C2T1", "C3T1", "C4T1", "C5T1")).Select
Range("E7:X57,AB8:AC57,AG8:AG57,AJ8:AK57").Select
Set rng = Selection
rng.Borders.LineStyle = xlContinuous
rng.Font.Name = "Angsana New"
rng.Font.Size = 14
rng.HorizontalAlignment = xlCenter
rng.Borders(xlInsideHorizontal).LineStyle = xlContinuous
Sheets(1).Select
Application.ScreenUpdating = True

Re: Sheets Array ทำงานแค่แผ่นงานเดียว

Posted: Fri Oct 20, 2017 10:24 am
by yangkodza
snasui wrote::D ตัวอย่าง Code ครับ

Code: Select all

Dim rng As Range
Application.ScreenUpdating = False
Sheets(Array("C1T1", "C2T1", "C3T1", "C4T1", "C5T1")).Select
Range("E7:X57,AB8:AC57,AG8:AG57,AJ8:AK57").Select
Set rng = Selection
rng.Borders.LineStyle = xlContinuous
rng.Font.Name = "Angsana New"
rng.Font.Size = 14
rng.HorizontalAlignment = xlCenter
rng.Borders(xlInsideHorizontal).LineStyle = xlContinuous
Sheets(1).Select
Application.ScreenUpdating = True
ขอบคุณมากครับ :thup: