earthworm
Well-known Member
- Joined
- May 19, 2009
- Messages
- 773
- Office Version
- 2019
- 2016
- Platform
- Windows
I want to create a macro that will create new sheet and save the same if the value in particular cells are >0
I created one but its only saving one sheet at a time and not moving to second macro if the value in first cell is >0
Please assist
I created one but its only saving one sheet at a time and not moving to second macro if the value in first cell is >0
Please assist
Code:
Sub if_1()If Range("c2").Value > 0 Then
Workbooks.Add
ChDir "C:\Users\_\Desktop"
ActiveWorkbook.SaveAs Filename:="C:\Users\_\Desktop\01.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
ElseIf Range("c3").Value > 0 Then
Workbooks.Add
ChDir "C:\Users\_\Desktop"
ActiveWorkbook.SaveAs Filename:="C:\Users\_\Desktop\02.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
ElseIf Range("c4").Value > 0 Then
Workbooks.Add
ChDir "C:\Users\_\Desktop"
ActiveWorkbook.SaveAs Filename:="C:\Users\_\Desktop\03.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
ElseIf Range("c5").Value > 0 Then
Workbooks.Add
ChDir "C:\Users\_\Desktop"
ActiveWorkbook.SaveAs Filename:="C:\Users\_\Desktop\04.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
End If
End Sub