尝试打印很多标签,我需要excel中的A列来读取类似的内容。
EH001`
EH001
EH001
EH001
EH002
EH002
EH002
EH002
EH003.......
我需要为数千个样本执行此操作,这是生成此列表的最简单方法吗?
答案 0 :(得分: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