VBA & macros
Automate repeat work with macros and VBA code.
- Excel VBA Error 400: Meaning, Causes, and How to Fix ItIn Excel VBA, error 400 means “Form already displayed; can’t show modally.” It usually appears when code tries to show a UserForm…
- VBA to Save Excel Tabs as Separate FilesYes. A VBA macro can copy each visible worksheet tab into a new workbook and save it as a separate .xlsx file;…
- VBA: Open an Excel File from SharePointTo open a SharePoint workbook with VBA, the most dependable approach is to sync its document library with OneDrive and pass the…
- VBA Open Excel File Read-Only: Syntax and ExamplesTo open an Excel workbook as read-only with VBA, use Workbooks.Open and set its ReadOnly argument to True. For example, Set sourceWb…
- VBA Open Text File in Excel: Methods, Code, and TipsTo open a text file with VBA in Excel for Microsoft 365 on Windows, use Workbooks.OpenText and specify how the file is…
- VBA Open Excel File From Path: Code and Common FixesTo open an Excel workbook from a known path in VBA, call Workbooks.Open and pass the full path as its Filename argument.…
- VBA MS Access Cell Color in Excel: Set Cells SafelyAccess does not have Excel-style worksheet cells, so Access VBA cannot color an Access table cell as if it were an Excel…
- VBA Open an Excel File and Copy Data into a WorkbookTo open an Excel file and copy its data with VBA, use Workbooks.Open to open the source workbook, then assign the source…
- VBA Open Excel File and Save as CSV with Working CodeYes. In VBA, open the workbook with Workbooks.Open, then call SaveAs with FileFormat:=xlCSVUTF8 to create a UTF-8 CSV file. Excel exports only…
- VBA Macro Excel Workbook: Enable Editing on Open SafelyNo: a VBA macro cannot safely or legitimately click Excel’s Enable Editing button in Protected View. To edit a workbook, first verify…
- VBA Macro to Open an Excel File and Copy DataTo open an Excel workbook and copy its data with VBA, use a macro that asks you to select a file, opens…
- VBA Excel Copy Entire Column: Code and TipsTo copy an entire column in Excel with VBA, use the column’s Copy method and specify the destination: wsSource.Columns("A").Copy Destination:=wsTarget.Columns("C"). This copies…
- VBA Excel Open and Save As Dialog Box: How It WorksIn Excel VBA, use Application.GetOpenFilename to display a file-selection dialog and Application.GetSaveAsFilename to ask where a file should be saved. Neither method…
- VBA Macro to Find the Last Row in Excel: Methods That WorkTo find the last nonblank row in column A, use lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row, where ws is the worksheet you want to…
- VBA Excel: Check a Cell’s FormatTo check a cell’s format in VBA, read the relevant property of its Range object: use Range("A1").NumberFormat for the number-format code, Range("A1").Interior.Color…
- VBA Code to Open an Excel File from a Folder SafelyTo open an Excel workbook from a folder with VBA, call Workbooks.Open with the workbook’s full file path. For example, the macro…
- VBA Code to Open an Excel File from a PathUse VBA’s Workbooks.Open method to open a workbook by its full file path. In Excel for Microsoft 365 on Windows, assign the…
- VBA Code to Open an Excel File from SharePointIn Excel for Microsoft 365 on Windows, use VBA’s Workbooks.Open method with the file’s direct SharePoint URL, provided you are signed in…
- VBA Code to Add a New Sheet in Excel: Examples and TipsTo add a new worksheet at the end of the workbook and give it a unique name, use a VBA macro like…
- VBA Code to Insert an Image in an Excel Cell AutomaticallyUse VBA’s Shapes.AddPicture method to insert a picture, then position and size it to match a worksheet cell. The macro below places…
- Run Macro in Excel Not Working? Causes, Checks, and Fixes to TryIf a macro will not run in Excel, first check that you opened the file in the desktop app, that it is…
- Excel VBA Run-time Error 70: Permission DeniedExcel VBA Run-time error 70, “Permission denied,” means the code tried to access a file, folder, or resource that Windows or another…
- Excel VBA Error 75: Fix Path/File AccessExcel VBA run-time error 75, “Path/File access error,” means a file operation could not access the path or file it was given.…
- Excel VBA Overflow Error: Causes, Examples, and FixesAn Excel VBA overflow error is Run-time error 6: VBA tried to store or calculate a number that is outside the range…
- OpenOffice and Excel VBA: What Works and What Doesn’tApache OpenOffice Calc can open many Excel workbooks, but it does not reliably run Microsoft Excel VBA macros. If a workbook depends…
- Open an App by File Path in Excel VBA: A Practical GuideTo open a Windows application from Excel VBA, use the Shell function with the full path to its executable, enclosed in quotation…
- Excel VBA Object Required Error: Causes and FixesIn Excel VBA, “Object required” is run-time error 424: VBA reached a statement that needs an object, such as a worksheet or…
- MS Access VBA: Open Excel Files and Read Their DataYes. In Microsoft Access VBA on Windows, you can open an Excel workbook by creating an Excel application object and calling its…
- Microsoft Excel VBA and Macro Training: What to LearnMicrosoft Excel VBA and macro training teaches you to automate repetitive workbook tasks, first by recording simple macros and then by writing…
- Microsoft Excel Cannot Run the Macro? Common FixesIf Microsoft Excel says it cannot run a macro, first check that you are using the desktop version of Excel, the workbook…