2014-09-26 21 views
0

試圖打印很多標籤,我需要在Excel中的列A來讀取類似的東西。爲郵件合併生成號碼列表

EH001` 
EH001 
EH001 
EH001 
EH002 
EH002 
EH002 
EH002 
EH003....... 

我需要爲數千個樣本做這件事,最簡單的方法來產生這個列表是什麼?

回答

1

嘗試是這樣的:在短期內我做了一個向下拖動列表

Dim NextRow As Long 
NextRow = Thisworkbook.Sheets("Sheet1").Cells(Rows.Count, 1).End(xlup).Row + 1 

For i = 1 To 10000 'or however many you need 
    If i < 10 Then 
     Range("A" & NextRow).Value = "EH00" & i 
    ElseIf i >= 10 And i < 100 Then 
     Range("A" & NextRow).Value = "EH0" & i 
    ElseIf i >= 100 And i < 1000 Then 
     Range("A" & NextRow).Value = "EH" & i 
    End If ' You can go on like this for as much as you need. 
Next i 
+0

得到了在年底這方面的工作,但(1,2,3,4 ECT等..),它複製到同一列4次,然後用過濾器進行排序! – user3234810 2014-09-30 13:19:32

+1

不錯!很高興我能幫忙,已經忘記了這個問題哈哈 – 2014-09-30 13:23:49