copy and paste without header

andysh

Board Regular
Joined
Nov 8, 2019
Messages
111
Hi,

I'm trying to copy and parse some data from colB to colC. I've recorded the below and it's fine but I'd like to leave the column headers intact.

I've tried changing the range to ("B2:B") and ("C2:C") but this doesn't seem to work. Looking around this and other sites it doesn't seem like an incorrect way of setting the range. Clearly there is some nugget of information I can't glean from forums which I need in order to be able to understand why it's incorrect and how to solve it.

Any advice would be much appreciated.


VBA Code:
Range("B:B").Select
Selection.Copy
Range("C:C").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("C1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="@", FieldInfo:=Array(Array(1, 9), Array(2, 1)), TrailingMinusNumbers:=True
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I can still see one reference to C1 in your code, also selection is not necessary and could be part of the problem if it is not doing as expected. Perhaps this will work.
VBA Code:
Dim lRow As Long
lRow = Cells(Rows.Count,2).End(xlUp).Row
Range("B2:B" & lrow).Copy Range("C2:C"& lRow)
Range("C2:C" & lRow).TextToColumns Destination:=Range("C2"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="@", FieldInfo:=Array(Array(1, 9), Array(2, 1)), TrailingMinusNumbers:=True
 
Upvote 0

Forum statistics

Threads
1,215,679
Messages
6,126,183
Members
449,296
Latest member
tinneytwin

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