Advertisement
YasserKhalil2019

T4724_Transfer Students Information SpecialCells Areas

Mar 31st, 2020
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. https://excel-egy.com/forum/t4724
  2. ---------------------------------
  3.  
  4. Sub Transfer_Students_Information_Loop_Through_SpecialCells_Areas()
  5. Dim a, ws As Worksheet, sh As Worksheet, myAreas As Areas, i As Long, j As Long, r As Long, m As Long, n As Long, x As Long
  6.  
  7. Application.ScreenUpdating = False
  8. Set ws = ThisWorkbook.Worksheets(1)
  9. Set sh = ThisWorkbook.Worksheets(2)
  10. Set myAreas = ws.Columns(8).SpecialCells(2).Areas
  11. m = 3
  12.  
  13. For i = 1 To myAreas.Count
  14. r = myAreas(i).Row + 10
  15. sh.Cells(m, 2).Value = Trim(Split(ws.Cells(r, "AC").Value, "اسم الطالب:")(1))
  16. sh.Cells(m, 3).Value = Trim(Replace(Replace(ws.Cells(myAreas(i).Row, "H").Value, "الصف", ""), "الابتدائي", ""))
  17. sh.Cells(m, 4).Value = ws.Cells(r, "U").Value
  18.  
  19. n = myAreas(i).Row + 17
  20.  
  21. For j = 1 To 8
  22. x = n + j - 1
  23. a = Array(ws.Cells(x, "AA").Value, ws.Cells(x, "V").Value, ws.Cells(x, "Q").Value, ws.Cells(x, "N").Value)
  24. sh.Cells(m, 4 * j + 1).Resize(, UBound(a) + 1).Value = a
  25. Next j
  26. m = m + 1
  27. Next i
  28. Application.ScreenUpdating = True
  29. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement