خرید بک لینک

Vote count: 0

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

asked 21 secs ago

برچسب: for loop to while loop,for loop to iterate a list in java,for loop to iterate a list in python,for loop tokens,for loop torch,for loop to while loop java,for loop to copy files in unix,for loop to populate an array,for loop to while loop python,for loop to read a file in python, نویسنده: استخدام کار تاريخ: چهارشنبه 24 شهريور 1395 ساعت: 14:41

صفحه بندی