Hello,
I am new to the forum and also new to VBA programming I am trying to program an if statement that has multiple steps/condition and have it loop until it meets a condition. The code and explanation is below. Thanks for all help & contributions in advance.
Sub alignjobs()
Range("P7").Select
''''Want to Loop the Whole Statement'''
'''If cell A is not blank and cell B is not blank then align right'''
'''If this isnt true then'''
'''If cell A is blank and cell B is not blank then Bold Font'''
'''Loop until Cell A and Cell B is Blank'''
If Selection.Offset(1, 0) <> "" Then
Selection.Offset(1, -8).Select
If Selection <> "" Then
With Selection
.HorizontalAlignment = xlRight
End With
Selection.Offset(0, 8).Select
Else
If Selection.Offset(1, 0) = "" Then
Selection.Offset(1, -8).Select
If Selection <> "" Then
Selection.Font.Bold = True
Selection.Offset(0, 8).Select
End If
End If
End If
End If
End Sub
I am new to the forum and also new to VBA programming I am trying to program an if statement that has multiple steps/condition and have it loop until it meets a condition. The code and explanation is below. Thanks for all help & contributions in advance.
Sub alignjobs()
Range("P7").Select
''''Want to Loop the Whole Statement'''
'''If cell A is not blank and cell B is not blank then align right'''
'''If this isnt true then'''
'''If cell A is blank and cell B is not blank then Bold Font'''
'''Loop until Cell A and Cell B is Blank'''
If Selection.Offset(1, 0) <> "" Then
Selection.Offset(1, -8).Select
If Selection <> "" Then
With Selection
.HorizontalAlignment = xlRight
End With
Selection.Offset(0, 8).Select
Else
If Selection.Offset(1, 0) = "" Then
Selection.Offset(1, -8).Select
If Selection <> "" Then
Selection.Font.Bold = True
Selection.Offset(0, 8).Select
End If
End If
End If
End If
End Sub