Copy a range of data to all sheets of the workbook

后端 未结 2 789
终归单人心
终归单人心 2021-01-27 13:47

I have a workbook that contains a database .

On that database there is a certain row of data that i would like to copy and paste to all sheets.

The copying ra

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-27 14:26

    Dim Rng As Range, _
        Inp As Range, _
        wS As Worksheet
    
    Set Inp = Selection
    Inp.Interior.ColorIndex = 37
    On Error Resume Next
    Set Rng = Application.InputBox("Copy to", Type:=8)
    On Error GoTo 0
    If TypeName(Rng) <> "Range" Then
        MsgBox "Cancelled", vbInformation
        Exit Sub
    Else
        Rng.Parent.Activate
        Inp.Copy
    
        For Each wS In ActiveWorkbook.Worksheets
            wS.Range("B1").Paste Link:=True
        Next
    End If
    
    Application.CutCopyMode = 0
    

提交回复
热议问题