ranges
Hi
try something like the following:
Sub move_characters()
Dim lastrow As Long
Dim row_index As Long
Dim col_index As Integer
Dim char_count As Integer
Dim source_wks As Worksheet
Dim target_wks As Worksheet
Dim sub_str As String
Set source_wks = Worksheets("Tabelle1")
Set target_wks = Worksheets("Tabelle2")
char_count = 8
lastrow = source_wks.Cells(Rows.Count, "A").End(xlUp).Row
For col_index = 1 To 2
For row_index = 1 To lastrow
If Len(source_wks.Cells(row_index, "A").Value) _
(col_index - 1) * char_count Then
sub_str = Mid(source_wks.Cells(row_index, "A").Value, _
(col_index - 1) * 8 + 1, char_count)
target_wks.Cells(row_index, col_index).Value = sub_str
End If
Next
Next
End Sub
--
Regards
Frank Kabel
Frankfurt, Germany
"Rich Cooper" schrieb im Newsbeitrag
...
I am working with a range of names, I want to take that range and
have a
macro take the first 8 characters of each cell in that range and
paste them
into another range. Then i want the macro to go back throught the
initail
range and take the next 8 characters and paste that to a second new
range
right next to the one with the first 8 characters. If this can be
done?
does anyone know how?
|