Search code examples
excelvbabuttoncopypaste

VBA Button Insert Letter into selected cell range and paste it into the same cell range on different Sheet


in Sheet1 I have a button which puts the letter "U" into my seleceted range of cells. (Code: Intersect(Selection, Selection) = "U"). Sheet2 hat the same structure (looks identical) as Sheet1, so after I press the button and my selected cells fill up with "U" letters, I want the "U" letter in the selected range of Sheet1 to be copied to the same cell range in Sheet2. (see IMG1)

IMG1

Thnak you in advance!

I tired to make a button for Sheet1 and adapat to Sheet2, but no success.


Solution

  • With Selection
        .Value = "U"
        Thisworkbook.worksheets("Sheet2").range(.Address) = "U" 'same range on Sheet2
    End With
    

    should do what you want