需要在不同的工作簿上使用文本到列功能(分隔)



提供的代码适用于自己的工作簿,但我需要它在不同的工作簿上工作

Dim objRange1 As Range 'text to columns parse
'Set up the ranges
Set objRange1 = Range("B1:B300")
'Do the first parse
objRange1.TextToColumns _
  Destination:=Range("B1"), _
  DataType:=xlDelimited, _
  Tab:=False, _
  Semicolon:=False, _
  Comma:=False, _
  Space:=False, _
  Other:=True, _
  OtherChar:=":"
Dim objRange1 as range
with workbooks("Book1").Worksheets("Production")
    set objrange1 = .range("B1:B300")
    objrange1.texttocolumns _
    Destination:=.Range("B1"), _
    DataType:=xlDelimited, _
    Tab:=False, _
    Semicolon:=False, _
    Comma:=False, _
    Space:=False, _
    Other:=True, _
    OtherChar:=":"
end with

最新更新