我实际上需要思考过程和选项的帮助,而不是真正的编码。Excel宏 - 值比较
我希望用户输入他们的邮政编码。然后,我需要查看邮政编码的范围。 编辑:因为我来自Belgium,邮编是4号长(1000,1500,8380,...)
Zip code: 2800
Range between;
1000-1999
2000-2999
3000-3999
4000-4999
If the range is between one of the following, display all zip codes for that range
Else do nothing
,我想出了一个如果,否则结构。但我想知道是否有更好的选择?
Zip code: 2800
If zip code > 3999 then
'Select all zipcodes within this range
'Range(" .. ").Copy Destination:=Sheets...
ElsIf zip code > 2999 then
'Select all zipcodes within this range
'Range(" .. ").Copy Destination:=Sheets...
Elsif zipcode ....
谢谢。
@@@@@@@@@@@@@
Openshac
我想出这个。
x = 1
Sheets("Reference").Select
For i = 1 to 115
If Range("A" & i).value > 5999 and Range("A" & i).value < 6000 then
Range("A" & i).copy Destination:=Sheets("Design").Range("A" & x)
x = x + 1
End if
Next i
什么是“做点什么”?每个邮政编码范围都会改变吗? – shahkalpesh 2011-04-07 08:21:35
等一下,我会改变它。 – CustomX 2011-04-07 08:27:57
hmmmm其中(Integer ??)数大于(>)5999,同时小于(<)6000 .....坏坏坏硬编码!所以这是否意味着任何给定的邮政编码,你想显示您的表中的所有邮政编码在理智的千位范围内......我制定了一个单独的答案 – MikeD 2011-04-07 11:58:57