christian21077
New Member
- Joined
- Mar 30, 2021
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hello everyone. I need to be able to stop a macro if the data of certain cells go to a negative number. The cells in question have a formula. (I dont know if that matters or no). Let me give you some background. The macro I have is basically using "goal seek" to find out angles. The macro is for several cells. Two Things I need to do. 1- I need to tell the macro to stop looking if cells BI31 through BK31 are negative numbers. 2- I need to know where to place the line, at the end of whole macro, or in between each process. Take a look at the macro I have:
Sub FindAngle()
'
' FindAngle Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Range("BP31").GoalSeek Goal:=0, ChangingCell:=Range("BL31")
Range("BP32").Select
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Range("BP32").GoalSeek Goal:=0, ChangingCell:=Range("BL32")
Range("BP33").Select
This macro goes up to BL44. So pretty much the same thing throughout the macro just different ranges. Your help will be appreciated.
Sub FindAngle()
'
' FindAngle Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Range("BP31").GoalSeek Goal:=0, ChangingCell:=Range("BL31")
Range("BP32").Select
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Range("BP32").GoalSeek Goal:=0, ChangingCell:=Range("BL32")
Range("BP33").Select
This macro goes up to BL44. So pretty much the same thing throughout the macro just different ranges. Your help will be appreciated.