Im using some code to manipulate some raw data before its imported into access.
here is where the problem is occurring:
Code:
Sub newtest()
celltxt2 = ActiveSheet.Range("e2").Text
celltxt = ActiveSheet.Range("F2").Text
If InStr(1, celltxt2, "Exp") Then
If InStr(1, celltxt, "0") Then
MsgBox "test"
Range("A2:F2").Select
Application.CutCopyMode = False
Selection.ListObject.ListRows(1).Delete
Else
MsgBox ("Expenses")
Exit Sub
End If
''''''''''''''''''''''''''''
Else
MsgBox "raw data is formatted incorrectly"
End If
End Sub
the variable celltxt always = 0 when its within the first if....
If this code is on its own (without the first if and associated code) then it works fine.
I did have this all working together briefly but now I have made some changes and it wont work.
Does anyone know what I'm doing wrong here?