ba drod bazam babate type finglish mazerat ,harchand in mabhas motmaenan ghablan bahsesh shode ama vase akharin bar ye nemone code mizarim ba tavajo be file dostemon,ye button to sheet tajamoeton mizarin masalan command button21 va codesh mishe in , darzemn code haro ghashang tahlil kon bebin chi mige , chera neveshte shode
کد:
Option Explicit
Private Sub CommandButton21_Click()
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
If Sheet1.Range("A2").Value <> "" Then
Dim lastrow As Long
lastrow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Sheet1.Range("A2:D" & lastrow).ClearContents
End If
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.CodeName <> "Sheet1" Then
With ws
.Range("A2:D" & .Cells(Rows.Count, 1).End(xlUp).Row).Copy Sheet1.Cells(Rows.Count, "A").End(xlUp).Offset(1)
End With
End If
Next ws
Sheet1.Activate
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
علاقه مندی ها (Bookmarks)