Hello everyone!
I am new to this forum and I would like to raise a question regarding the thread :
http://www.mrexcel.com/forum/excel-...utomatically-insert-new-rows.html#post4521996
I would like to do this same operation but the column I want to replicate is in column "HT".
How can I change this macro do to the transpose in column "HT"?
Additionally, why I am always getting the following error "Mismatch" highlighting the "Sheets("sheet1").Range("a1").Resize(c, UBound(Ray, 2)) = Application.Transpose(nray)".
I have no idea how to correct it.
Appreciated!
K.Regards
Sara
Sub som()
Dim Ray As Variant, n As Long, Sp As Variant, c As Long, s As Long, Ac As Long
Ray = ActiveSheet.Range("A1").CurrentRegion
ReDim nray(1 To UBound(Ray, 2), 1 To 1)
For n = 1 To UBound(Ray, 1)
Sp = Split(Ray(n, 2), ",")
For s = 0 To UBound(Sp)
c = c + 1
ReDim Preserve nray(1 To UBound(Ray, 2), 1 To c)
For Ac = 1 To UBound(Ray, 2)
If Ac = 2 Then
nray(Ac, c) = Sp(s)
Else
nray(Ac, c) = Ray(n, Ac)
End If
Next Ac
Next s
Next n
Sheets("sheet1").Range("a1").Resize(c, UBound(Ray, 2)) = Application.Transpose(nray)
MsgBox "Run"
End Sub
I am new to this forum and I would like to raise a question regarding the thread :
http://www.mrexcel.com/forum/excel-...utomatically-insert-new-rows.html#post4521996
I would like to do this same operation but the column I want to replicate is in column "HT".
How can I change this macro do to the transpose in column "HT"?
Additionally, why I am always getting the following error "Mismatch" highlighting the "Sheets("sheet1").Range("a1").Resize(c, UBound(Ray, 2)) = Application.Transpose(nray)".
I have no idea how to correct it.
Appreciated!
K.Regards
Sara
Sub som()
Dim Ray As Variant, n As Long, Sp As Variant, c As Long, s As Long, Ac As Long
Ray = ActiveSheet.Range("A1").CurrentRegion
ReDim nray(1 To UBound(Ray, 2), 1 To 1)
For n = 1 To UBound(Ray, 1)
Sp = Split(Ray(n, 2), ",")
For s = 0 To UBound(Sp)
c = c + 1
ReDim Preserve nray(1 To UBound(Ray, 2), 1 To c)
For Ac = 1 To UBound(Ray, 2)
If Ac = 2 Then
nray(Ac, c) = Sp(s)
Else
nray(Ac, c) = Ray(n, Ac)
End If
Next Ac
Next s
Next n
Sheets("sheet1").Range("a1").Resize(c, UBound(Ray, 2)) = Application.Transpose(nray)
MsgBox "Run"
End Sub