根据前四位数字和后四位数字过滤一行是一列

所以我一直在使用一些macros来编码来根据一列中的值来过滤行。 这对于我在一般意义上所做的工作是有效的,但是我需要做一些更具体的事情。 我一直在使用的是这样的:

Dim c As Range, x As Integer 'other code here Set c = shtMaster.Range("Y5") 'Start search in Row 5 'other code here While Len(c.Value) > 0 'If value in column Y ends with specified value,copy to report sheet If c.Value Like "*2130" Or c.Value Like "*0853" Then 'rest of macro follows 

我一直在试图弄乱If行,这样我就可以为前四位和后四位数字添加条件,而不是仅仅使用基于最后四位的值。 例如,我可能想要search列Y的前四位数字是“1234 *”,但最后四位数字不是“* 5678”的所有值。 所以如果我有一个电子表格:

  Column Y 

第1行12345678
第2行12341234
第3行12340000

那么它会拉第2行和第3行,但不是第1行。我想使用上面的结构,因为这是如何一切都已经写好,但我似乎无法得到正确的语法。 我想用我已经写好的结构做什么? 如果是的话,有什么build议? 谢谢。

 If c.Value Like "1234*" And Not c.Value Like "*5678" Then 'Values start with 1234 and do not end in 5678. End If