هذا لأنني لم أضع بالحسبان تلك العلامات الخاصة التي بالملف "علامات السالب" ------ ------ ---- --
وأيضا عدلت ترتيب السطرين التاليين واستبدلت كلمة "end" بكلمة " ## "
Sheets(3).Cells(i, j - 1).ClearContents
Sheets(3).Cells(i, x + 1).Value = " ## "
الكود بعد التعديل
أضفت خطوة لاستبدال أي علامة سالب بلاشيء
Cells.Replace What:="-", Replacement:=""
Sub copy_2_end()
LstC = [IV1].End(xlToLeft).Column
LstR = [A65530].End(xlUp).Row
Range("A1", [A1].Offset(LstR - 1, LstC - 1)).Select
i = 1: j = 1: f_end = 0
Cells.Replace What:="-", Replacement:=""
For Each ce In Selection
If f_end = 1 Then GoTo 10
5 Sheets(3).Cells(i, j).Value = ce.Value
j = j + 1
If ce.Value = "end" Then
For x = j - 2 To 1 Step -1
If Sheets(3).Cells(i, x) <> "" Or Left(Sheets(3).Cells(i, x), 1) <> "-" Then
Sheets(3).Cells(i, j - 1).ClearContents
Sheets(3).Cells(i, x + 1).Value = " ## "
Exit For
End If
Next x
i = i + 1
j = 1
f_end = 1
End If
GoTo 20
10 If ce.Value <> "" Then f_end = 0: GoTo 5
20
Next ce
[A1].Select
End Sub
بارك الله فيك و جعله في ميزان حسناتك و جزاك الله عنا كل خير