Hello there,
I Would like to ask for help with my Excel project.
This is my VBA code:
Private Sub Workbook_Open()
Range("H9").Value = Range("H9").Value + 1
Range("B23:B29").ClearContents
Range("name").MergeArea.ClearContents
Range("sirname").MergeArea.ClearContents
Range("G18").MergeArea.ClearContents
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
ActiveSheet.Copy
NewFN = "C:\Users\Lukáš IvančÃ*k\Desktop\protokol" & Range("H9").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
I need that lines under Workbook_BeforeClose will run only if for example range cell (B33:43) will contain some value.
If not, nothing do. For example, When I open this excel file but data are not input to cell, excel will not create new file like in that case I insert some data to cell.
I am helpless, please give me some advice.
Thanks so much.
I Would like to ask for help with my Excel project.
This is my VBA code:
Private Sub Workbook_Open()
Range("H9").Value = Range("H9").Value + 1
Range("B23:B29").ClearContents
Range("name").MergeArea.ClearContents
Range("sirname").MergeArea.ClearContents
Range("G18").MergeArea.ClearContents
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
ActiveSheet.Copy
NewFN = "C:\Users\Lukáš IvančÃ*k\Desktop\protokol" & Range("H9").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
I need that lines under Workbook_BeforeClose will run only if for example range cell (B33:43) will contain some value.
If not, nothing do. For example, When I open this excel file but data are not input to cell, excel will not create new file like in that case I insert some data to cell.
I am helpless, please give me some advice.
Thanks so much.