اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

وعليكم السلام ورحمة الله تعالى وبركاته

جرب هدا 

Private Sub CommandButton1_Click()
Dim newWb As Workbook
Dim WS As Worksheet: Set WS = Sheets("Sheet18")

Path = ThisWorkbook.Path & "\"   'OR =====>>'"D:\test\"
If WS.[E2] = 0 Then: Exit Sub
Application.ScreenUpdating = False
Application.DisplayAlerts = False

WS.Copy
Set newWb = ActiveWorkbook
newWb.SaveAs Filename:=Path & WS.[E2] & ".xlsx", FileFormat:=51
newWb.Close
   
   Application.DisplayAlerts = True
   Application.ScreenUpdating = True

    MsgBox "Saved successfully"
End Sub

 

SAV 18.xlsb

  • Like 1
  • أفضل إجابة
قام بنشر (معدل)

 

 او جرب هدا ربما هدا ما تقصده 

Private Sub CommandButton1_Click()
Dim WS As Worksheet, NewWb As Workbook
Dim Path As Variant
Set WS = Worksheets("Sheet18")

If WS.[E2] = 0 Then: Exit Sub

'Path = "D:\test\"   في حالة كان المسار ثابت يمكنك تعديل السطر التالي بما يناسبك '

' اختيار مسار الحفظ
Path = Application.GetSaveAsFilename(InitialFileName:=WS.[E2], _
fileFilter:="Excel Files (*.xlsx), *.xlsx", Title:="الرجاء اختيار مكان الحفظ")
If Path <> False Then

Application.DisplayAlerts = False
Application.ScreenUpdating = Fals

WS.Copy
Set NewWb = ActiveWorkbook
    With NewWb.Sheets(1).UsedRange
        .Value = .Value
    End With
   NewWb.SaveAs Path, FileFormat:=51
   '****************************************************************
  '  هدا للمسار الثايت
'   NewWb.SaveAs Filename:=Path & WS.[E2] & ".xlsx", FileFormat:=51
'*********************************************************************
   NewWb.Close
     
 Application.DisplayAlerts = True
 Application.ScreenUpdating = True
    
    MsgBox "Saved successfully"
       Unload Me
    End If
End Sub

 

SAV 18 v2.xlsb

تم تعديل بواسطه محمد هشام.
  • Like 2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information