UNION Method

     

  • UNION Method combines two to more ranges
  • More than one range is required to execute UNION method
  •  

     

    Syntax of UNION Method:

     

     

    1)Union Method - Two different Range Cells:

     

     

     

     

    2)Union Method - Combining Ranges:

     

    Private Sub CommandButton1_Click()
    Dim first As Range, last As Range, Total As Range
    Set first = Range("B4:I9")
    Set last = Range("B15:I21")
    Set Total = Union(first, last)
    Total.Interior.ColorIndex = 3
    Total.Font.Size = 18
    Total.Font.Bold = True
    End Sub