VBA text to column with destination in other sheet

kayza

Board Regular
Joined
Apr 29, 2015
Messages
61
Office Version
  1. 2007
Platform
  1. Windows
hi excel master
I have a VBA code like this
Code:
Application.DisplayAlerts = False
bs = 17
For i = 19 To 100 Step 6
Set obj = Sheets("[COLOR=#0000ff][B]AA[/B][/COLOR]").Cells(32, i)
    obj.TextToColumns _
    Destination:=Sheets("[COLOR=#ff0000][B]BB[/B][/COLOR]").Cells(bs, 6), DataType:=xlDelimited, OtherChar:="x"
    bs = bs + 1
Next

the code above does not work as I expected,
I want the source to come from sheet AA
but the destination is on sheet BB

How to do this?

Thank you in advance
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You cant as far a im aware. Needs same sheet. Try this to see if it does the same:

Code:
bs = 17

With Sheets("AA")
    arr = .Range(.Cells(32, 19), .Cells(32, 100))
    For i = LBound(arr, 2) To UBound(arr, 2) Step 6
        For j = LBound(Split(arr(1, i), "x")) To UBound(Split(arr(1, i), "x"))
            Sheets("BB").Cells(bs, 6 + j) = Split(arr(1, i), "x")(j)
        Next
        bs = bs + 1
    Next
End With
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top