Hi experts and gurus,
I have referenced the following code to call the workbook to open if not open and then copy data from one of the sheet and paste them in the sheet of another workbook (move or copy and check copy).
Function Code:
Move or copy code:
Now I would want to disable these codes (both MoveOrCopy and the function codes) if the sheet in that another workbook contains data and is not empty. If the sheet in that another workbook is empty then run the codes.
Thanks
Roshan Shakya
I have referenced the following code to call the workbook to open if not open and then copy data from one of the sheet and paste them in the sheet of another workbook (move or copy and check copy).
Function Code:
Code:
Function checkFileIsOpen(chkSumFile As String) As Boolean
On Error Resume Next
checkFileIsOpen = (Workbooks(chkSumFile).Name = chkSumFile)
On Error GoTo 0
End Function
Move or copy code:
Code:
Private Sub MoveOrCopy()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim sh3 As Worksheet
Application.DisplayAlerts = False
Set wb1 = Workbooks("Germany.xlsx")
Set wb2 = Workbooks("Canada.xlsm")
Set sh3 = Worksheets("Ambience")
Workbooks("Germany.xlsx").Sheets("Ambience").Range("A1:J2000").Copy _
Destination:=Workbooks("Canada.xlsm").Sheets("Ambience").Range("A1")
Application.DisplayAlerts = True
End Sub
Now I would want to disable these codes (both MoveOrCopy and the function codes) if the sheet in that another workbook contains data and is not empty. If the sheet in that another workbook is empty then run the codes.
Thanks
Roshan Shakya