0% found this document useful (0 votes)
0 views

Auto Edit Excel VBA

Uploaded by

khozai0615
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Auto Edit Excel VBA

Uploaded by

khozai0615
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

***************put into source excel.

xlsm

Private Sub Worksheet_Change(ByVal Target As Range)


' Define source and destination ranges
Dim sourceRange As Range
Dim destinationRange As Range
Dim destinationRange2 As Range
Dim destinationRange3 As Range
Dim destinationRange4 As Range

' Only trigger the copy if the change occurs within the range you care about
If Not Intersect(Target, Me.Range("A1:B200")) Is Nothing Then
' Set source range
Set sourceRange = Me.Range("A1:B200")

' Set destination range (adjust this as needed)


Set destinationRange = ThisWorkbook.Sheets("Destination").Range("A1")
Set destinationRange2 = ThisWorkbook.Sheets("second").Range("A1")
Set destinationRange3 = ThisWorkbook.Sheets("third").Range("A1")
Set destinationRange4 = ThisWorkbook.Sheets("fourth").Range("A1")

' Copy values and formatting


sourceRange.Copy
destinationRange.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
destinationRange.PasteSpecial Paste:=xlPasteFormats
destinationRange.PasteSpecial Paste:=xlPasteColumnWidths

destinationRange2.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
destinationRange2.PasteSpecial Paste:=xlPasteFormats
destinationRange2.PasteSpecial Paste:=xlPasteColumnWidths

destinationRange3.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
destinationRange3.PasteSpecial Paste:=xlPasteFormats
destinationRange3.PasteSpecial Paste:=xlPasteColumnWidths

destinationRange4.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
destinationRange4.PasteSpecial Paste:=xlPasteFormats
destinationRange4.PasteSpecial Paste:=xlPasteColumnWidths

' Clear the clipboard


Application.CutCopyMode = False
End If
End Sub

You might also like