Forum Discussion

Alicia645's avatar
Alicia645
Copper Contributor
Aug 06, 2021
Solved

I'm pretty sure the answer's no, but...

...is there a way to "glue" cells in Excel? 

 

If you have three cells (all containing independent, unrelated values) that you often copy and paste as a group, just from one area of a spreadsheet to another, is there a way to glue them so that you only have to click once--in any area of the three cells--to select all three and move or copy them as a group? 

 

Any advice appreciated,

Alicia

 

 

  • Alicia645 

     

    If a vba solution is acceptable, then I think you may be able to do that.

     

    If you select the cells and give them a name (say "MyGroup", for example), then right click on your worksheet, click view code, and paste this into the code window,  then it should select the group of cells whenever you select one of them. Just change the range name in the code to whatever you decide to use.

     

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
         If Not Intersect(Target, Me.Range("MyGroup")) Is Nothing Then
              Application.EnableEvents = False
              Me.Range("MyGroup").Select
              Application.EnableEvents = True
         End If
    End Sub

     

5 Replies

  • JMB17's avatar
    JMB17
    Bronze Contributor

    Alicia645 

     

    If a vba solution is acceptable, then I think you may be able to do that.

     

    If you select the cells and give them a name (say "MyGroup", for example), then right click on your worksheet, click view code, and paste this into the code window,  then it should select the group of cells whenever you select one of them. Just change the range name in the code to whatever you decide to use.

     

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
         If Not Intersect(Target, Me.Range("MyGroup")) Is Nothing Then
              Application.EnableEvents = False
              Me.Range("MyGroup").Select
              Application.EnableEvents = True
         End If
    End Sub

     

    • Alicia645's avatar
      Alicia645
      Copper Contributor

      Hi JMB17,
      This is a little bit above my pay grade but I think I have someone who can help me with it. I have a couple of questions first...

      If the cells I am grouping have different values (text on the left and time on the right), will each cell retain its original properties, i.e., EXCEL will recognize the number on the right as an expression of hours and minutes and be able to perform calculations as usual, as long as I have previously chosen that number format for that cell?

      I would have to choose a unique range name for each pair of cells, wouldn't I?

      Thanks for your help!
      A.

      • Alicia645's avatar
        Alicia645
        Copper Contributor
        Oh, holy (insert dirty word)! I did it myself! It works!
        I didn't even have to call any of my kids to help me!
        Thanks so much!
        A.

Resources