Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Filter PivotTable dropdown items to match report filter | Excel Discussion (Misc queries) | |||
Copy only visible cells after filter is applied/ sum after filter | Excel Worksheet Functions | |||
filter: how to print filter list options in dropdown box | Excel Discussion (Misc queries) | |||
Need macro to filter, create tab on filter and copy/paste | Excel Programming | |||
"Criteria Range" in the "Data/Filter/Advanced Filter" to select Du | Excel Worksheet Functions |