ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If JobNumber = Val(field(7)) Then Query (https://www.excelbanter.com/excel-programming/404533-if-jobnumber-%3D-val-field-7-then-query.html)

joecrabtree

If JobNumber = Val(field(7)) Then Query
 
To all,

I have the following code:

If JobNumber = Val(field(7)) Then


It looks at field (7) which is typically a 5 digit number i.e. 36238

If JobNumber = 36238 then it will continue the script.

however in some cases the value in field (7) is 36238 OP1 or 36238/2
etc. How can I get it to search just the first 5 digits i.e 36238 of
the field (7) value, and enable the script to continue, rather than
returning nothing as it does at the moment?

Thanks in advance for your help,

regards

Joseph Crabtree

Dave Peterson

If JobNumber = Val(field(7)) Then Query
 
How about the first 5 characters:

If JobNumber = Val(left(field(7),5) then

joecrabtree wrote:

To all,

I have the following code:

If JobNumber = Val(field(7)) Then

It looks at field (7) which is typically a 5 digit number i.e. 36238

If JobNumber = 36238 then it will continue the script.

however in some cases the value in field (7) is 36238 OP1 or 36238/2
etc. How can I get it to search just the first 5 digits i.e 36238 of
the field (7) value, and enable the script to continue, rather than
returning nothing as it does at the moment?

Thanks in advance for your help,

regards

Joseph Crabtree


--

Dave Peterson


All times are GMT +1. The time now is 06:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com