![]() |
Filter using Mid
Hi,
I have been going around and aroung with this. I am trying to filter to the 6th digit of a string. My variables show the correct values when I step through this yet it does not fall into the call. Here is my code: Sub AddCAMLineItem() Dim NuRow As Long Dim ItemCol As String Dim EndItemCol As String Dim NuCostCode As String Dim NuLineItem As String Dim NuItemAmount As Long Dim CodeType As String Dim StartRow As Long Dim Lusedrow As Long StartRow = 4 NuLineItem = frmPoolList.txtNewPoolType.Value NuItemAmount = Val(frmPoolList.txtLineItemAmount.Value) NuCostCode = Left(frmPoolList.txtNewPoolType.Value, 9) CodeType = Mid(NuCostCode, 6, 1) If InStr("Tax", NuLineItem) Then Call AddTaxItem(StartRow, Lusedrow, ItemCol, EndItemCol) GoTo ContTax Else If InStr("TAX", NuLineItem) Then Call AddTaxItem(StartRow, Lusedrow, ItemCol, EndItemCol) GoTo ContTax End If End If Select Case CodeType Case CodeType = "0" Call AddCAMExteriorItem(StartRow, Lusedrow, ItemCol, EndItemCol) Case CodeType = "1" Call AddCAMInteriorItem(StartRow, Lusedrow, ItemCol, EndItemCol) End Select ContTax: End Sub Right now I am working with the Exterior Line Item. The NuCostCode is "6128-0000" which in turn has a CodeType of "0" in the 6th digit. This value shows in step through but the code does not drop into the Call AddCAMExteriorItem statement. What am I missing? -- Thanks for your help. Karen53 |
Filter using Mid
Hi Karen,
Try:- Case "0" -- Regards, OssieMac "Karen53" wrote: Hi, I have been going around and aroung with this. I am trying to filter to the 6th digit of a string. My variables show the correct values when I step through this yet it does not fall into the call. Here is my code: Sub AddCAMLineItem() Dim NuRow As Long Dim ItemCol As String Dim EndItemCol As String Dim NuCostCode As String Dim NuLineItem As String Dim NuItemAmount As Long Dim CodeType As String Dim StartRow As Long Dim Lusedrow As Long StartRow = 4 NuLineItem = frmPoolList.txtNewPoolType.Value NuItemAmount = Val(frmPoolList.txtLineItemAmount.Value) NuCostCode = Left(frmPoolList.txtNewPoolType.Value, 9) CodeType = Mid(NuCostCode, 6, 1) If InStr("Tax", NuLineItem) Then Call AddTaxItem(StartRow, Lusedrow, ItemCol, EndItemCol) GoTo ContTax Else If InStr("TAX", NuLineItem) Then Call AddTaxItem(StartRow, Lusedrow, ItemCol, EndItemCol) GoTo ContTax End If End If Select Case CodeType Case CodeType = "0" Call AddCAMExteriorItem(StartRow, Lusedrow, ItemCol, EndItemCol) Case CodeType = "1" Call AddCAMInteriorItem(StartRow, Lusedrow, ItemCol, EndItemCol) End Select ContTax: End Sub Right now I am working with the Exterior Line Item. The NuCostCode is "6128-0000" which in turn has a CodeType of "0" in the 6th digit. This value shows in step through but the code does not drop into the Call AddCAMExteriorItem statement. What am I missing? -- Thanks for your help. Karen53 |
Filter using Mid
Thank you OssieMac!
-- Thanks for your help. Karen53 "OssieMac" wrote: Hi Karen, Try:- Case "0" -- Regards, OssieMac "Karen53" wrote: Hi, I have been going around and aroung with this. I am trying to filter to the 6th digit of a string. My variables show the correct values when I step through this yet it does not fall into the call. Here is my code: Sub AddCAMLineItem() Dim NuRow As Long Dim ItemCol As String Dim EndItemCol As String Dim NuCostCode As String Dim NuLineItem As String Dim NuItemAmount As Long Dim CodeType As String Dim StartRow As Long Dim Lusedrow As Long StartRow = 4 NuLineItem = frmPoolList.txtNewPoolType.Value NuItemAmount = Val(frmPoolList.txtLineItemAmount.Value) NuCostCode = Left(frmPoolList.txtNewPoolType.Value, 9) CodeType = Mid(NuCostCode, 6, 1) If InStr("Tax", NuLineItem) Then Call AddTaxItem(StartRow, Lusedrow, ItemCol, EndItemCol) GoTo ContTax Else If InStr("TAX", NuLineItem) Then Call AddTaxItem(StartRow, Lusedrow, ItemCol, EndItemCol) GoTo ContTax End If End If Select Case CodeType Case CodeType = "0" Call AddCAMExteriorItem(StartRow, Lusedrow, ItemCol, EndItemCol) Case CodeType = "1" Call AddCAMInteriorItem(StartRow, Lusedrow, ItemCol, EndItemCol) End Select ContTax: End Sub Right now I am working with the Exterior Line Item. The NuCostCode is "6128-0000" which in turn has a CodeType of "0" in the 6th digit. This value shows in step through but the code does not drop into the Call AddCAMExteriorItem statement. What am I missing? -- Thanks for your help. Karen53 |
All times are GMT +1. The time now is 01:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com