Need to change Range("A1") to refer to row 1 of active cell's column

General Ledger

Active Member
Joined
Dec 31, 2007
Messages
460
Dear All,

I am trying to create a Macro which uses the Text to Columns feature of Excel. My problem is telling the macro the Destination of the output.


When I execute the macro, I want it to:
1. Select the entire column of the active cell
2. Change the format of all the cells to Text
3. Place the output on top of the current column
4. End

Here is what I have so far:

Sub TextToColumns()
'
Application.ScreenUpdating = False
'
ActiveCell.EntireColumn.TextToColumns Destination:=Range("a1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 2), TrailingMinusNumbers:=True
End Sub


My problem is with Destination:=Range("a1"). I want the Destination to start in row 1 of the column of the active cell. The way the macro works now, the output is placed beginning at cell A1 of the worksheet.

Thanks,

GL
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,224,536
Messages
6,179,402
Members
452,909
Latest member
VickiS

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