Multiple If Statements VBA -
i'm new vba , sql, , i'm building table uploaded sql onto excel , using vba. want if column i(check market) or j(check m2) have value says #na go no further , don't carry out upload or rest of code. think 1 of problems might have if loop - successful , has no errors associated it.
this code far
'where marked sht.cells(row,15) = "x" 'first if loop if sht.cells(lrow, 15) = "x" 'if or j columns #n/a not continue if iserror(sht.cells(lrow, 9).value) msgbox "error in column 'check market'" if iserror(sht.cells(lrow, 10).value) msgbox "error in column 'check m2'" ''''at moment above part isn't running, notifies user of error doesn't stop process. 'change blank spaces null ******* ssql = *******main part of code goes here****** 'execute queries ******** 'put 'null' values blank ''''' end if 'end of if x loop
i'm not clear if there's possibility both columns might have error i've provided in case.
'if or j #n/a dont proceed upload. if iserror(sht.cells(lrow, 9).value) , iserror(sht.cells(lrow, 10).value) msgbox "errors in both columns" elseif iserror(sht.cells(lrow, 9).value) msgbox "error in column 'check market'" elseif iserror(sht.cells(lrow, 10).value) msgbox "error in column 'check kpi'" else: 'continue end if
Comments
Post a Comment