willow1985
Well-known Member
- Joined
- Jul 24, 2019
- Messages
- 929
- Office Version
- 365
- Platform
- Windows
I need help with a code. It has been a very long day and I know my code is a mess.
All I want the below code to do is open the workbook specified, which it does fine - we will call this Workbook A
Activate Workbook A
If Range O15 in Workbook A is "FALSE" Then
Activate Workbook B
On current row position: Range(Cells(Selection.Row, 22), Cells(Selection.Row, 22)).ClearContents
give a Msg box
If Range O15 is "TRUE" Then close workbook A
and Activate Workbook B
Currently it only opens the file and activates Workbook B.
Workbook A is showing as FALSE in O15
Any help would be greatly appreciated. Thank you!
All I want the below code to do is open the workbook specified, which it does fine - we will call this Workbook A
Activate Workbook A
If Range O15 in Workbook A is "FALSE" Then
Activate Workbook B
On current row position: Range(Cells(Selection.Row, 22), Cells(Selection.Row, 22)).ClearContents
give a Msg box
If Range O15 is "TRUE" Then close workbook A
and Activate Workbook B
Currently it only opens the file and activates Workbook B.
Workbook A is showing as FALSE in O15
Any help would be greatly appreciated. Thank you!
VBA Code:
Sub Verify_Form()
'
' Verify_Form Macro
'
Dim FORM As String
FORM = ActiveCell.Offset(0, 4).Range("A1").Value 'WORKBOOK A
Workbooks.Open FORM
'Activate WORKBOOK A
If Worksheets("CC").Range("O15").Value = "FALSE" Then
Workbooks("Customer Concern - Warranty Request Log.xlsm").Activate 'WORKBOOK B
ActiveCell.ClearContents
MsgBox "CC Report incomplete. Please complete the report before closing out"
Else
'Close WORKBOOK A
Workbooks("Customer Concern - Warranty Request Log.xlsm").Activate 'WORKBOOK B
End If
'
End Sub