I can’t get my currant testing code to skip a section of code IF a given range is Blank/zero.
Currant my testing code is not skipping the section of code that clears that range, and then move onto the next section of code if THAT range is "Blank"
As my testing code stands, I'm getting the MsgBox regardless whether the range is "Blank" or clearly contains a value
My intention is:
IF range “fUsedRng = sht.Range("AN" & DestRow + 2)" is blank/zero, a MsbBox is displayed.
It will then SKIP the next section that “Clears” that range and move onto rest of code.
Hopefully the below contains enough code to understand what I’m trying to do!!!
It is not my actual testing, just an outline
Essentially this is about whether my logic is correct and where my code has/ is falling short, NOT about an ultimate resolving code, (I won’t learn as much from that)
Currant my testing code is not skipping the section of code that clears that range, and then move onto the next section of code if THAT range is "Blank"
As my testing code stands, I'm getting the MsgBox regardless whether the range is "Blank" or clearly contains a value
My intention is:
IF range “fUsedRng = sht.Range("AN" & DestRow + 2)" is blank/zero, a MsbBox is displayed.
It will then SKIP the next section that “Clears” that range and move onto rest of code.
Hopefully the below contains enough code to understand what I’m trying to do!!!
It is not my actual testing, just an outline
Essentially this is about whether my logic is correct and where my code has/ is falling short, NOT about an ultimate resolving code, (I won’t learn as much from that)
Excel Formula:
Sub IfRangeBlank_ContinueToNextSection()
Dim sht As Worksheet
Dim rng As Range
Dim DestRow As Long
Dim fUsedRng As Range
Set sht = ThisWorkbook.ActiveSheet
Set fUsedRng = sht.Range("AN" & DestRow + 1)
If fUsedRng = 0 Then
MsgBox "FUsedRng is empty skip next section of code and GO TO next step/section of code", vbOKOnly
GoTo Line1:
End If
'-----------------------
'Skip this section of code that clears "sht.Range("AN" & DestRow + 2)"
IF "fUsedRng" is BLANK ("") or is not 0
'-----------------------------------------------
Line1:
On Error Resume Next
'Continue with rest of code