I had a quick question about how to set up a for loop to use a trim function to copy and paste string values in a range of cells. I've got that part working well enough, thanks entirely to a script I found written by @Jeeped on a Microsoft forum. But now I need to get the script to run down the length of the entire columns adjacent to the one I am using the trim function on and place the extracted values.
Currently the trim funtion works fine but I can not get it to place the extracted values in the subsequent ranges. It is currently stuck in the same cell.
Any help would be much appreciated! Here is a copy of the code.
enter code here
Sub cut_first_to_somewhere()
Dim rng As Range, target As Range
Set target = Range("B2") '<< set this to the correct destination
For Each rng In Range("C2:C1000")
target = Trim(Left(rng.Text, InStr(1, rng.Text & Chr(32), Chr(32))))
rng = Trim(Replace(rng, target, vbNullString, 1, 1))
target = target.Offset(0, -1)
Next rng
End Sub
