moustafaabdelhady
New Member
- Joined
- Feb 4, 2019
- Messages
- 5
I have created a macro to copy from one cell to another in another workbook.
Although works perfectly fine on windows, it doesnt work on Mac
I am not a pro, can anybody help to get it work on Mac please
Here is the Macro :
Although works perfectly fine on windows, it doesnt work on Mac
I am not a pro, can anybody help to get it work on Mac please
Here is the Macro :
Code:
Sub Make_New_File()
'
' Make_New_File() Macro
Application.ScreenUpdating = False
Dim Path As String
Dim filename As String
Dim filetoopen As String
Dim filetoopen2 As String
Dim Wbk As Workbook
Dim Ws As Worksheet
Set sFolder = ThisWorkbook.Sheets("Database").Range("MainFolder")
Set FValidation = ThisWorkbook.Sheets("Database").Range("FolderValidation")
filetoopen = ThisWorkbook.Sheets("Database").Range("NewCustomerFile")
filetoopen2 = ThisWorkbook.Sheets("Database").Range("NewCustomerFile2")
If Dir(sFolder) <> (FValidation) Then
Workbooks.Open (filetoopen2)
'open if the folder from the main desktop
Workbooks("Natuurelle.xlsb").Sheets("Klant | Patient Registratie").Activate
Range("C2").Select
Range("C" & Rows.Count).End(xlUp).Offset(0, 8).Select
Selection.Copy
Windows("Patient map sjabloon.xlsb").Activate
Sheets("Patient map").Select
Range("D7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Application.DisplayAlerts = False
ActiveWorkbook.CheckCompatibility = False
Path2 = ThisWorkbook.Sheets("Database").Range("CustomersFilesArchive")
filename = Range("C1").Value & " - " & Range("D1")
ActiveWorkbook.SaveAs filename:=Path2 & filename & ".xlsb", FileFormat:=xlExcel12, CreateBackup:=False
Else
Workbooks.Open (filetoopen)
'open if the folder from the other desktop
Workbooks("Natuurelle.xlsb").Sheets("Klant | Patient Registratie").Activate
Range("C2").Select
Range("C" & Rows.Count).End(xlUp).Offset(0, 8).Select
Selection.Copy
Windows("Patient map sjabloon.xlsb").Activate
Sheets("Patient map").Select
Range("D7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Application.DisplayAlerts = False
ActiveWorkbook.CheckCompatibility = False
Path2 = ThisWorkbook.Sheets("Database").Range("CustomersFilesArchive2")
filename = Range("C1").Value & " - " & Range("D1")
ActiveWorkbook.SaveAs filename:=Path & filename & ".xlsb", FileFormat:=xlExcel12, CreateBackup:=False
End If
MsgBox "Klant map is gemakt voor:" _
& " " & Sheets("Patient map").Range("D1").Value
Application.ScreenUpdating = True
End Sub
Last edited by a moderator: