VBA Code to Add New Sheet | Excel VBA Tutorial in Hindi

Опубликовано: 07 Октябрь 2024
на канале: Automation Fever
4,012
72

VBA Code to Add New Sheet | Excel VBA Tutorial in Hindi
It's really easy to add new sheet using VBA code. You just need to use Add Method of Worksheets collection. You can also add Chart Sheet or Macro Sheet using the same function.

🔴 Subscribe for more videos just like this: https://bit.ly/2PUQwXk

🎧In this video, you will learn
►How to add single sheet in excel using VBA
►How to rename excel sheet in VBA
►How to comment VBA code
►How to add multiple excel sheet in VBA
►How to add worksheet in last
►How to add sheet in start
►How to add Chart Sheet in macro
►How to add a macro sheet in excel VBA

🕘Content of this video :-
00:00 Intro
01:47 Add Single Sheet
02:39 Rename excel sheet
05:20 Rename sheet according to user
07:40 Add multiple Sheets
08:55 Add Sheet in last
12:30 Add Sheet in Start
14:05 Add Chart Sheet
15:34 Add Macro Sheet

Download Excel Macro File For Practice 👉 https://github.com/AutomationFever/Au...
➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖
🖥️Video Summary 👉
To add a new sheet in your worksheet, we use Add function of Worksheets collection.
Below is the code for adding a new sheet :-
Sub AddSheet()
Worksheets.Add
End Sub

If you want to change the name of your sheet. You need to use name property of Worksheets collection.
Below is sample code to rename a sheet :-
Sub RenameSheet()
' Worksheets("Sheet2").Name = "dummy"
' Worksheets(2).Name = "mySheet"

Worksheets(1).Name = VBA.InputBox(Prompt:="Please enter sheet name", Title:="Rename Sheet")
End Sub

To add multiple sheets at one time in vba, you can use Count property of Worksheets collection Add function.
Below is a example for the same:-
Sub AddMultiSheets()
Worksheets.Add Count:=4
End Sub

You can use After property to add a sheet after any sheet. If you need to add a sheet after last sheet in your excel workbook, you can either pass the name of last worksheet in After property of Add function or you can also pass the count of total sheets.
Sub AddSheetInLast()
' Worksheets.Add After:=Worksheets("mySheet")
Worksheets.Add After:=Worksheets(Worksheets.Count)
'Debug.Print Worksheets.Count
End Sub

To add a sheet before any worksheet, you need to pass the worksheet name in Before property of Add function.
Sub AddsheetInStart()
Worksheets.Add Before:=Worksheets(3)
End Sub
➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖

Hope you found this video useful. Please like, share and subscribe to our channel. This will motivate us to create more good contents. Thanks!

🎬Watch our most recent videos:    / automationfever  

💜You Might be Interested in (Free Tutorials):
Basic VBA Tutorials (Hindi)👉    • Why Should Learn VBA | VBA क्यों सीखे...  
Advanced VBA Tutorials (Hindi)👉    • Send Outlook Mail in VBA | VBA Outloo...  
Excel VBA Projects (Hindi) :👉    • Add & Change Sheet Tab Color of 50 Sh...  
VBA Outlook Automation (Hindi)👉    • Send Outlook Mail in VBA | VBA Outloo...  
Excel Tips & Tricks (Hindi)👉    • Copy From Clipboard - Excel Tips & Tr...  

➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖
🎧Do watch our Other VBA Videos (Hindi) 👉
Subroutine 👉    • Subroutine | Excel VBA Tutorial in Hindi  
Object Hierarchy 👉 https://www.youtube.com/watch?v=D-cJX...
Deleting Sheets 👉    • VBA to Delete Sheets | Excel VBA Tuto...  
Change Sheet Tab Color 👉    • Change Sheet Tab Color Using VBA | Ex...  
Hide/Unhide Sheets 👉    • VBA Code to Hide and Unhide Sheets  |...  
Grouping Sheets 👉    • Grouping Sheets in VBA | Excel VBA Tu...  
Copy and Move Sheet 👉    • Copy and Move Sheets in VBA | Excel V...  
Protect and Unprotect Sheet 👉    • Protect and Unprotect Sheets Using VB...  
Add Background Image in Sheet 👉    • Add Background Image in Sheet | Excel...  
Working With Workbook 👉    • Working With Workbooks in VBA | Excel...  
Range 👉    • Range in VBA | Excel VBA Tutorial in ...  
Variables 👉    • Variables in VBA | Excel VBA Tutorial...  
If Else Statements 👉    • VBA If Else Statement | Excel VBA Tut...  
Select Case Statement 👉    • VBA Select Case Statement | Excel VBA...  
➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖〰➖

-------------------------------SOCIAL-------------------------------
🛠️ If you have any doubt or query, drop us an email: [email protected]
🌎Website : http://www.automationfever.com/
👥Facebook:   / feverautomation  
🐦Twitter:   / automationfever  
📸Instagram:   / automationfever  
📕Blogger : https://automationfever.blogspot.com
----------------------------------------------------------------------

#addsheet #addingsheets #addnewworksheet #excel #vba #excelvba #automationfever #excelvbatutorial #howoaddnewseet