Merge cell in Excel programmatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nagarajan Venu
    New Member
    • Aug 2011
    • 2

    #1

    Merge cell in Excel programmatically

    HI,

    i need to merger two cells if the values is exceeds the width of the cells.

    for example i have string like "Internet" so it will fir in single cell. if have string like"Internet protected level is off" for this i need merge the automatically i dont want wrap with the same

    can any one provide solution for this.
    thanks in advance
  • R MacDonald
    New Member
    • Mar 2011
    • 24

    #2
    Hello, Nagarajan,

    Here is a simple example. I hope this gives you an idea about how to proceed.

    Dim xlaTest As New Excel.Applicati on
    xlaTest.Visible = True
    Dim wbkTest As Excel.Workbook = xlaTest.Workboo ks.Open("D:\Tes ts\VB Trials\ExcelTes ts\TestWorkbook .xls")
    Dim wshTest As Excel.Worksheet = DirectCast(wbkT est.Worksheets( "Sheet1"), Excel.Worksheet )

    wshTest.Range(" F3:G3").MergeCe lls = True

    Cheers,
    Randy

    Comment

    • Nagarajan Venu
      New Member
      • Aug 2011
      • 2

      #3
      HI Randy

      I already found the solution.
      thanks for your effort

      Comment

      Working...