我實際上需要思考過程和選項的幫助,而不是真正的編碼。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