Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
If (and( - with VBA
RowNum = 0
On Error Resum Next RowNum = Application.Match(1,(Textbox1.Text=A1:A100)*(Textb ox2.Text=B1:B100)*(Textbox3.Text=C1:C100)*(Textbox 4.Text=D1:D100),0) On Error Goto 0 If RowNum = 0 Then MsgBox " Information doesn't belong to project #" Else ... End If -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Eduardo" wrote in message ... Hi and thank you in advance for your help How do I write an statement that use if and with vba. here is what I need to do, I have information saved in one sheet "Projects" with 4 columns, Client, Project name, Project # and Business. then I have and userform to to apply expenses against each project so I need to compare the information enter in each textbox with the columns in the data base if one of them doesn't match a message will show up and will not allow the user to continue until is fixed. an example will be Client= A Project name = A1 Project # = 1 Business = APP so in order to apply anything to project # 1 all the others fields entered have to match A, A1 & APP I am thinking in something like, if(and(textbox1=A:A, textbox2=B:B, textbox3=C:C, textbox4=D:D) then Else msgbox = " Information doesn't belong to project #" |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
If (and( - with VBA
Hi Bob,
Thank you so much that was exactly what I was looking for, just one more question when the error message shows up I press enter and all the information is deleted is any way that at least the project # stays so the user goes and change whatever was wrong in the other fields. Thank you "Bob Phillips" wrote: RowNum = 0 On Error Resum Next RowNum = Application.Match(1,(Textbox1.Text=A1:A100)*(Textb ox2.Text=B1:B100)*(Textbox3.Text=C1:C100)*(Textbox 4.Text=D1:D100),0) On Error Goto 0 If RowNum = 0 Then MsgBox " Information doesn't belong to project #" Else ... End If -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Eduardo" wrote in message ... Hi and thank you in advance for your help How do I write an statement that use if and with vba. here is what I need to do, I have information saved in one sheet "Projects" with 4 columns, Client, Project name, Project # and Business. then I have and userform to to apply expenses against each project so I need to compare the information enter in each textbox with the columns in the data base if one of them doesn't match a message will show up and will not allow the user to continue until is fixed. an example will be Client= A Project name = A1 Project # = 1 Business = APP so in order to apply anything to project # 1 all the others fields entered have to match A, A1 & APP I am thinking in something like, if(and(textbox1=A:A, textbox2=B:B, textbox3=C:C, textbox4=D:D) then Else msgbox = " Information doesn't belong to project #" |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
If (and( - with VBA
Hi Bob, I checked when the information doesn't match but if the information
match it gives me the error message as well, thank you for your help "Bob Phillips" wrote: RowNum = 0 On Error Resum Next RowNum = Application.Match(1,(Textbox1.Text=A1:A100)*(Textb ox2.Text=B1:B100)*(Textbox3.Text=C1:C100)*(Textbox 4.Text=D1:D100),0) On Error Goto 0 If RowNum = 0 Then MsgBox " Information doesn't belong to project #" Else ... End If -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Eduardo" wrote in message ... Hi and thank you in advance for your help How do I write an statement that use if and with vba. here is what I need to do, I have information saved in one sheet "Projects" with 4 columns, Client, Project name, Project # and Business. then I have and userform to to apply expenses against each project so I need to compare the information enter in each textbox with the columns in the data base if one of them doesn't match a message will show up and will not allow the user to continue until is fixed. an example will be Client= A Project name = A1 Project # = 1 Business = APP so in order to apply anything to project # 1 all the others fields entered have to match A, A1 & APP I am thinking in something like, if(and(textbox1=A:A, textbox2=B:B, textbox3=C:C, textbox4=D:D) then Else msgbox = " Information doesn't belong to project #" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|