In continuation from here…
We already covered here how to create the form, set references and place the required buttons.
Here is an example for merging cells A1 to E1.
Imports Excel = Microsoft.Office.Interop.Excel Public Class Form1 '~~> Define your Excel Objects Dim xlApp As New Excel.Application Dim xlWorkBook, xlWorkBook2 As Excel.Workbook Dim xlWorkSheet, xlWsheet2 As Excel.Worksheet Dim xlSourceRange, xlDestRange As Excel.Range Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click '~~> Opens Source Workbook. Change path and filename as applicable xlWorkBook = xlApp.Workbooks.Open("C:\Tutorial\Sample.xlsx") '~~> Display Excel xlApp.Visible = True '~~> Set the source worksheet xlWorkSheet = xlWorkBook.Sheets("Sheet1") '~~> Set the source range xlSourceRange = xlWorkSheet.Range("A1", "E1") '~~> Merge the range xlSourceRange.Merge() '~~> If you want center alignment of the text horizontly and vertically then use this xlSourceRange.HorizontalAlignment = Excel.Constants.xlCenter xlSourceRange.VerticalAlignment = Excel.Constants.xlCenter End Sub End Class