Hi,
So what I am doing is pasting in data from another program. I want to write a macro to take that data, put each piece of data and put it in its own cell, then delete the first column. The issue is I can't get VBA to do this and put the data in the same spot it was. Every thing I have tried ends up with the data in the same spot, say cell B2, so it keeps writing over my previous data. I have included what I have so far. I select the data, then hit run and VBA moves it to a section I will keep empty, puts the data into individual cells, moves it back over (this is the problem) and deletes the first column of data. The moving it back over is where I want it to move it back to where it started not to a permanently specified cell...or I not have to move it in the first place (had trouble before this idea). When I didn't move it, the act of putting it into columns using VBA sent it to a specified place again, not the place it started.
Selection.Cut
Range("Q2").Select
ActiveSheet.Paste
Selection.TextToColumns Destination:=Range("Q2"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(6, 1), Array(11, 1), Array(25, 1), Array(37, 1))
Range("R2:U16").Select
Selection.Cut
Range("B2").Select
ActiveSheet.Paste
Range("Q2:Q16").Select
Selection.ClearContents
End Sub
So what I am doing is pasting in data from another program. I want to write a macro to take that data, put each piece of data and put it in its own cell, then delete the first column. The issue is I can't get VBA to do this and put the data in the same spot it was. Every thing I have tried ends up with the data in the same spot, say cell B2, so it keeps writing over my previous data. I have included what I have so far. I select the data, then hit run and VBA moves it to a section I will keep empty, puts the data into individual cells, moves it back over (this is the problem) and deletes the first column of data. The moving it back over is where I want it to move it back to where it started not to a permanently specified cell...or I not have to move it in the first place (had trouble before this idea). When I didn't move it, the act of putting it into columns using VBA sent it to a specified place again, not the place it started.
Selection.Cut
Range("Q2").Select
ActiveSheet.Paste
Selection.TextToColumns Destination:=Range("Q2"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(6, 1), Array(11, 1), Array(25, 1), Array(37, 1))
Range("R2:U16").Select
Selection.Cut
Range("B2").Select
ActiveSheet.Paste
Range("Q2:Q16").Select
Selection.ClearContents
End Sub