Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-29-2017, 09:59 AM
dwirony dwirony is offline Macro with Multiple If Statements Windows 7 64bit Macro with Multiple If Statements Office 2003
Advanced Beginner
 
Join Date: Oct 2016
Posts: 49
dwirony will become famous soon enough
Default

This covers the first 7 rules. I'm a little uncertain of rule 8. This is going to apply to all the other rules?

Code:
Sub MoveValues()
'
' MoveValues Macro
' First Seven rules written here. Note I'm using <> and = to determine if the cell has a value/no value.
'
If Range("B6").Value <> "" And Range("B8").Value = "" And Range("B12").Value = "" Then
   Range("B27").Value = Range("B6").Value
 
ElseIf Range("B6").Value = "" And Range("B8").Value <> "" And Range("B12").Value = "" Then
   Range("B27").Value = Range("B8").Value
 
ElseIf Range("B6").Value = "" And Range("B8").Value = "" And Range("B12").Value <> "" Then
   Range("B27").Value = Range("B12").Value
 
ElseIf Range("B6").Value = "" And Range("B8").Value <> "" And Range("B10").Value <> "" Then
   Range("B27").Value = Range("B8").Value & "/" & Range("B10").Value
 
ElseIf Range("B6").Value <> "" And Range("B8").Value = "" And Range("B10").Value <> "" Then
   Range("B27").Value = Range("B6").Value & "/" & Range("B10").Value
 
ElseIf Range("B6").Value = "" And Range("B8").Value = "" And Range("B10").Value <> "" Then
   MsgBox "The number is a required field. Please make the necessary adjustments."
 
ElseIf Range("B6").Value <> "" And Range("B8").Value <> "" And Range("B10").Value <> "" And Range("B12").Value <> "" Then
   MsgBox "You have entered too many numbers. Please make the necessary adjustments."
 
End If
 
End Sub
Reply With Quote
 

Tags
button, if statements, macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro with Multiple If Statements Multiple If statements, Jamal NUMAN Excel 16 11-15-2022 11:59 PM
Macro with Multiple If Statements Using multiple IF statements on a mail merge ajh19742000 Mail Merge 1 11-01-2016 06:11 PM
Macro with Multiple If Statements Help with if then statements brent chadwick Word VBA 35 07-25-2015 02:41 PM
Mailmerge certain text using multiple if statements Debs Mail Merge 4 06-19-2014 03:34 AM
Multiple If statements bremen22 Excel 2 10-15-2013 06:37 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft