Excel ขั้นเทพ Macro / VBA | We Mahidol | การ ใช้ macro excel

Excel ขั้นเทพ Macro / VBA | We Mahidol


นอกจากการดูบทความนี้แล้ว คุณยังสามารถดูข้อมูลที่เป็นประโยชน์อื่นๆ อีกมากมายที่เราให้ไว้ที่นี่: ดูความรู้เพิ่มเติมที่นี่

สำหรับใครที่ต้องใช้โปรแกรม Microsoft Excel ในการทำงานซ้ำ ๆ ในรูปแบบเดิม
เช่น การสรุป report รายสัปดาห์ทุก ๆ สัปดาห์ จากข้อมูลจำนวนมาก
ในโปรแกรม Microsoft Excel มีกลุ่มคำสั่งอัตโนมัติที่เรียกว่า Macro และ VBA
ที่จะช่วยลดการทำงานจากหลายชั่วโมงให้เสร็จได้ภายในคลิกเดียวเท่านั้น
WeMahidol Mahidol MicrosoftExcel Excel
YouTube : We Mahidol
Facebook : http://www.facebook.com/wemahidol
Instagram : https://www.instagram.com/wemahidol/
Twitter : https://twitter.com/wemahidol
TikTok : https://www.tiktok.com/@wemahidol
มหาวิทยาลัย มหิดล Mahidol University : https://www.mahidol.ac.th/th/
Website : https://channel.mahidol.ac.th/

Excel ขั้นเทพ Macro / VBA | We Mahidol

การเขียนคำสั่งแมโครใน Excel และการสร้างปุ่มคำสั่งแมโคร


คลิปนี้เป็นการสอนการเขียนคำสั่งแมโครในโปรแกรม Excel และสอนวิธีการสร้างปุ่มสำหรับสั่งให้คำสั่งแมโครทำงาน

การเขียนคำสั่งแมโครใน Excel และการสร้างปุ่มคำสั่งแมโคร

สอน Excel VBA : การใช้ VBA นำเข้าข้อมูลจากไฟล์อื่น ๆ แบบเลือกได้


การใช้งาน Excel VBA นำเข้าข้อมูลจาก Excel ไฟล์อื่น ๆ แบบเลือกไฟล์ได้ ด้วยการเรียกใช้ File Dialog
============================================

แนะนำตัวครับ ผมชื่อ วิภาคย์ นะครับ หวังว่าจะเป็นประโยชน์กับหลายคนนะครับ ทำขึ้นเพราะอยากแชร์ครับ กั๊กไว้แล้วคันปาก 5555
ขอบคุณที่กด Like และ ติดตามนะครับ
============================================
Program : Microsoft Office 2019 or Office365
============================================
Sub Import()
Dim CrntWorkBook As Workbook ‘ไฟล์ของเรา
Dim SourceBook As Workbook ‘ไฟล์ที่จะ Copy
Dim SourceRange As Range ‘range ของไฟล์ที่จะ Copy
Dim Destination As Range ‘range ของไฟล์ที่จะวาง
Set CrntWorkBook = ActiveWorkbook

With Application.FileDialog(msoFileDialogOpen)
.Title = \”เลือก File เลยจ้า\”
.InitialFileName = ThisWorkbook.Path \u0026 \”\\\”
.Filters.Clear
.Filters.Add \”Excel Files\”, \”.xl;.xm\”
.AllowMultiSelect = False
.Show

If .SelectedItems.Count (เปลี่ยนตรงนี้เป็นเครื่องหมายมากกว่า ไม่ต้องใส่วงเล็บ) 0 Then
Workbooks.Open .SelectedItems(1)
Set SourceBook = ActiveWorkbook

SourceBook.Activate
Set SourceRange = Range(\”B2:C13\”)
CrntWorkBook.Activate
Set Destination = Range(\”A1\”)
SourceRange.Copy Destination
Destination.CurrentRegion.EntireColumn.AutoFit

SourceBook.Activate
Set SourceRange = Range(\”E2:F14\”)
CrntWorkBook.Activate
Set Destination = Range(\”D1\”)
SourceRange.Copy Destination
Destination.CurrentRegion.EntireColumn.AutoFit

SourceBook.Close False
MsgBox (\”เสร็จ!\”)
Else
MsgBox (\”ท่านไม่ได้เลือกไฟล์ File\”) ‘ถ้าไม่ได้เลือกไฟล์
End If
End With
End Sub
============================================

สอน Excel VBA : การใช้ VBA นำเข้าข้อมูลจากไฟล์อื่น ๆ แบบเลือกได้

Macro Excel (ep.3) : เก็บ Macro ที่ไหนได้บ้าง


Automation Macro Excel ช่วงที่ 3 เก็บ Macro ที่ไหนได้บ้าง
มาเรียนรู้และรู้จักที่เก็บ Macro ว่าใน Microsoft Excel นั้น สามารถที่ใดได้บ้าง
ที่เก็บมาโคร (Macro Store)
1. This Workbook คือการจัดเก็บไว้ที่ไฟล์ Excel นั้น โดยมีข้อดีคือมาโครจะอยู่ที่ไฟล์นั้น สามารถจัดส่งให้คนอื่นได้ แต่จำเป็นจะต้องบันทึกเป็นไฟล์นามสกุล .xlsm (Excel Macro Enable) หรือ .xlsb (Excel Binary Workbook) ก็ได้
2. Personal Macro Workbook หรือการจัดเก็บมาโครไว้ที่เครื่อง โดยจะมีที่จัดเก็บเฉพาะในโฟลเดอร์ XLStart ซึ่งข้อดีของการจัดเก็บในส่วนนี้คือสามารถทำการเรียกใช้มาโครนี้ได้จากทุก ๆ ไฟล์ในเครื่อง
3. New Workbook เป็นการสร้างมาโครเพื่อให้มาโครดังกล่าว ไปไว้ยัง Workbook ใหม่อัตโนมัติ
ดังนั้นในการจัดเก็บมาโครควรจะต้องกำหนดให้เหมาะสมกับงาน เพื่อให้ได้ประสิทธิภาพสูงสุดในการทำงาน

9EXPERT TRAINING  มีหลักสูตรการอบรมเกี่ยวกับ  Excel Macro เป็นแบบ  Classroom หากสนใจลองดูได้ที่ https://www.9experttraining.com/excelmacroandvbatrainingcourse
[แนะนำหลักสูตรการอบรมด้าน Microsoft Excel ของ 9Expert Training]Microsoft Excel Intermediate
https://www.9experttraining.com/excelintermediatetrainingcourse
Microsoft Excel Advanced
https://www.9experttraining.com/exceladvancedtrainingcourse
Microsoft Excel Advanced Pivot Table and Pivot Chart
https://www.9experttraining.com/exceladvancedpivottableandpivotcharttrainingcourse
Microsoft Excel Macro and VBA
https://www.9experttraining.com/excelmacroandvbatrainingcourse
Microsoft Excel Power BI Business Intelligence
https://www.9experttraining.com/excelpowerbitrainingcourse

[อบรมแบบ Online]1. Microsoft Excel Intermediate
https://online.9experttraining.com/courses/microsoftexcelintermediate
2. Microsoft Excel Advanced
https://online.9experttraining.com/courses/microsoftexceladvanced
3. Excel Interactive Dashboard :
https://online.9experttraining.com/courses/microsoftexcelinteractivedashboard

9Expert Training
เราสอนสไตล์ใช้งานจริง
สอบถามเพิ่มเติมได้ที่ 0221943045
Line : @9EXPERT
ดูบทความและหลักสูตรทั้งหมดของเราได้ที่
www.9ExpertTraining.com
www.youtube.com/9expert

Macro Excel (ep.3) : เก็บ Macro ที่ไหนได้บ้าง

How to Create Macro Buttons in Excel Worksheets


In this video I explain the 3 ways to create macro buttons in Excel worksheets. These are buttons that run macros when the button is pressed. Download the Excel file:
There are 3 ways to add macro buttons to a worksheet in Excel:
1. Shapes
2. Form Control buttons
3. ActiveX buttons
In the video I explain my favorite method, and the pros \u0026 cons of each.
I also explain how to prevent the buttons from moving and resizing when changes are made to the sheet. This can happen when you add/remove rows \u0026 columns, or adjust row height or column width.
Adding macro buttons to your spreadsheets can make it much easier for other users that are not familiar with Excel. Instead of having them complete a bunch of steps in a complex process, they can just click a button to run a macro. The macro runs your VBA code that automates the task(s).
Additional Resources:
How to Enable the Developer Tab in Excel: https://youtu.be/JLQ8OuW0FlY
How to Add Macro Buttons to the Ribbon (Toolbar) in Excel: https://youtu.be/dmdolFcSfI
How to Add a Yes/No Popup Message Box Before a Macro Runs: https://youtu.be/rCh7ki9yVsM
Create Macro Buttons for Filters in Excel: https://youtu.be/a8r20T1c_JU
Create Macro Buttons for Pivot Tables: https://youtu.be/vLISpSGKhlQ

How to Create Macro Buttons in Excel Worksheets

นอกจากการดูหัวข้อนี้แล้ว คุณยังสามารถเข้าถึงบทวิจารณ์ดีๆ อื่นๆ อีกมากมายได้ที่นี่: ดูบทความเพิ่มเติมในหมวดหมู่WIKI

Leave a Comment