#ボツ回答シリーズ :)
DataObjectって意外と便利。と思ってたりする。
「ActiveSheetのA:T列の空白セル以外のデータをヨコ方向優先順でタテ1列に並べ直したい」ニーズがあったとして..
DataObjectって意外と便利。と思ってたりする。
「ActiveSheetのA:T列の空白セル以外のデータをヨコ方向優先順でタテ1列に並べ直したい」ニーズがあったとして..
Sub test()
Dim reg As Object
Dim s As String
Set reg = CreateObject("VBScript.RegExp")
reg.Global = True
reg.Pattern = "¥t+"
With ActiveSheet
Intersect(.UsedRange, .Columns("A:T")).Copy
End With
With GetObject("new:1C3B4210-F441-11CE-B9EA-00AA006B1A69")
.GetFromClipboard
s = .GetText
.Clear
.SetText reg.Replace(s, vbLf)
.PutInClipboard
End With
With Sheets.Add
.Paste .Range("A1")
End With
Set reg = Nothing
End Sub
Dim reg As Object
Dim s As String
Set reg = CreateObject("VBScript.RegExp")
reg.Global = True
reg.Pattern = "¥t+"
With ActiveSheet
Intersect(.UsedRange, .Columns("A:T")).Copy
End With
With GetObject("new:1C3B4210-F441-11CE-B9EA-00AA006B1A69")
.GetFromClipboard
s = .GetText
.Clear
.SetText reg.Replace(s, vbLf)
.PutInClipboard
End With
With Sheets.Add
.Paste .Range("A1")
End With
Set reg = Nothing
End Sub