从行到列发布URL的最佳方法

时间:2015-03-06 18:36:05

标签: excel

我在1个单元格中有50,000个URL,用空格分隔。如何告诉Excel获取每个URL并将其放在自己的列中。

我尝试使用Text to Columns然后使用Transpose,但是从左到右没有足够的列来处理50,000个单元格。

1 个答案:

答案 0 :(得分:0)

你可以用VBA

来做

sub ParseURLs()

dim vList as variant
dim sWS as worksheet
dim aCell as range
dim vItem as variant
dim lCol as long 
dim lRow as long 
lrow = 0
set sws = thisworkbook.sheets("Sheet1")
set aCell = sws.Range("A1")

'*** parse url list into an array
vlist = split(aCell, " ")
lcol = 1
for each vitem in vlist
  if vitem <> "" then
    acell.offset(lrow,lcol).value = vitem
    lcol = lcol + 1

    if lcol = 16384 then '*** total columns in excel
      lrow = lrow + 1
      lcol = 1
    endif
  endif

下一个vitem 结束子