How to ignore vba excel error runtime error '1004'
How to Browse file and open select file vba code
How to Browse file and open select file vba code
Below vba code
--------------------------------------------------------------------------------------------------------
Sub browsefileopen()
'below browse file code
myfile = Application.GetOpenFilename(, , "Browse for File")
'browse filename update with file location in active sheet.
ThisWorkbook.Sheets("sheet1").Range("a2")...
This workbook contains links to other data sources-Excel vba code
How to Move Excel sheet Data to Other workbook
Example1:-Move Excel sheet Data to Other workbook
Copy Below Code and Paste in Module
Sub movefileotherworkbook()
Workbooks.Open Filename:="C:\NitinVbaAppAMD\nitin1.xlsx"
ActiveSheet.Range("A2:F4").Copy
Workbooks.Open Filename:="C:\NitinVbaAppAMD\nitin2.xlsx"
'eColumn = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
'If eColumn >=...
how to run Macro Excel file from vbs script.
VBS script Example.
how to run Macro Excel file from vbs script.
Step1- Open Notepad
>>paste below code>>File Save filename.vbs and run vbs file.
----------------------------------------------------------------------------
Set ObjExcel=CreateObject("Excel.Application")
objExcel.Application.Run"'C:\NitinVbaAppST\nitintest.xlsm'!Module1.msgtest"
ObjExcel.DisplayAlerts=False
ObjExcel.Application.Quit
Set...
Excel sound play code:
Excel sound play code:-
Option Explicit
Private Declare Function sndPlaySound32 Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName _
As String, ByVal uFlags As Long) As Long
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
Dim PlaySound As Boolean
If Target.Column = 3...
Break Link Vba Code in excel
Below BreakLink code download-Please Paste Code in modul
Sub BreakLinks()
Dim iii As Variant
Dim astrLinks As Variant
' Define variable as an Excel link type.
astrLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)
' Break the first link in the active workbook.
For iii =...
Outlook Mail send Code
Outlook mail send code
Below code copy and paste module
click here for download file:- Outlook send mail file
_______________________________________________
Sub Send_Mail()
Dim outlookobj As Outlook.Application
Dim mitem As Outlook.MailItem
Set outlookobj = New Outlook.Application
Set mitem = outlookobj.CreateItem(olMailItem)
With...
How to create right click commnad bar in excel
Paste code in thisworkbook(vba code) in excel file
For click example file download:- click here Right click commandbar file download
Note after code paste file save in macro xlsm format and open again
Copy below code
__________________________________________________________
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim...
How to List All Files in a Folder and Create Hyperlinks to Each File
How to List All Files in a Folder and Create Hyperlinks to Each File
Below VBA Code:-
Sub Example1()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder("C:\NitinVbaApp\Images\")
i = 1
For Each objFile...
How to Delete all Shape image in Excel sheet
How to Delete all Shape image in Excel sheet
----------------------------------------------------
Sub Delshape()
Dim shape As Excel.shape
For Each shape In ActiveSheet.Shapes
Select Case shape.Type
Case msoPicture, msoMedia, msoShapeTypeMixed, msoOLEControlObject, msoAutoShape
...
How to Add slide vba powerpoint | How to Delete All Slide Power point
How to Add slide vba powerpoint
Below code:-
---------------------------------------------------------------------------
Sub addppt()
Dim objPresentaion As Presentation
Set objPresentaion = ActivePresentation
Call objPresentaion.Slides.Add(1, PpSlideLayout.ppLayoutBlank)
End Sub
---------------------------------------------------------------
How...
Powerpoint slide with excel vba code
Powerpoint slide with excel vba code
below click download file click link
https://drive.google.com/open?id=1Iglclf_H-xGuzbhQDssdZ86IkVa0mz_G
Please paste code in excel vba code moudle .
please add shape in excel sheet.
below copy code
---------------------------------------------
Sub expshape()
Dim myppt As PowerPoint.Application
Set myppt = New...
How to use Triple Loop VBA Excel
How to use Triple Loop VBA Excel
Example:-1
----------------------------------------------------
Sub myTripleLoop()
Dim c As Integer, i As Integer, j As Integer
For c = 1 To 3
For i = 1 To 6
For j = 1 To 2
Worksheets(c).Cells(i, j).Value = 1700
...
How to use Double Loop VBA Excel
How to use Double Loop VBA Excel
Example:-
---------------------------------------------------
Sub myDoubleLoop()
Dim i As Integer, j As Integer
For i = 1 To 6
For j = 1 To 3
Cells(i, j).Value = 100
Next j
Next i
End Sub
--------------------------------------------------------...
For Loop Example VBA Excel
For Loop Example VBA Excel
Example 1:-
Sub myforloop()
Dim i As Integer
Dim inp As Integer
Dim Disp As Integer
Disp = InputBox("Please Enter Display Number")
inp = InputBox("Please entry number for looping")
For i = 1 To inp
Cells(i, 1).Value = Disp
Next i
End S...
List of Folders In Directory VBA Excel Code
List of Folders In Directory VBA Excel Code
Below copy code and Paste Module
-----------------------------------------------------
Sub ListFoldersInDirectory()
Dim objFSO As Object
Dim objFolders As Object
Dim objFolder As Object
Dim strDirectory As String
Dim arrFolders()...
On Error Resume Next And On Error GoTo Example of Excel VBA
On Error Resume Next And On Error GoTo Example of Excel VBA
below click for download file
https://drive.google.com/open?id=1HpUj-gBSTERFIj6tdV8FQpIrx6bmqJ_h
Below Example vba code
---------------------------------------
Sub onerrohandlingerror()
Dim rank As Integer
rank = InputBox("Enter Rank no")
On Error Resume Next
MsgBox Columns(1).Find(What:=rank).Offset(0,...
How to Extract file name from folder excel vba
How to Extract file name from folder excel vba
Please click for download file
https://drive.google.com/open?id=1HpUj-gBSTERFIj6tdV8FQpIrx6bmqJ_h
Below VBA code
-------------------------------------------------------
Sub myextrfile()
Dim n As Integer
Dim i As Integer
Dim xx As String
With Application.FileDialog(msoFileDialogOpen)
...
How to USerform - only Userform Visible not Excel Sheet
How to make excel VBA power point slide
How to make excel VBA power point slide
Click for Download file:-https://drive.google.com/file/d/1twWXZ1JAGuF0nLQYqaToj--fsqba4nKW/view?usp=sharing
Below copy code and paste excel vba module - 100% Working
--------------------------------------------------------------------------------------
Sub powerpointmyppt()
Dim ppapp As PowerPoint.Application
Dim...
Excel Vba Expire Date Close file code
What is Range object | Vba Range Object Example
VBA Excel Programme 1 | How to use Workbook, Worksheets, Sheet
VBA Excel Programme 1
Example 1:-
Sub vbafirst()
' workbook
use for file name describe
Application.Workbooks("vbafirst").Worksheets(2).Range("A1").Value
= "Sheet 2 using"
'worksheet
use for sheet file name/sheet index/position
Worksheets("mysheet1").Range("a1").Value
= "sheet 1 using"
'worksheet
use for sheet file name/sheet index/position
Worksheets(4).Range("a1").Value...