Chuyển dòng thành cột trong word 2003 (2 người xem)

  • Thread starter Thread starter lypt
  • Ngày gửi Ngày gửi
Liên hệ QC

Người dùng đang xem chủ đề này

lypt

Thành viên chính thức
Tham gia
20/8/08
Bài viết
61
Được thích
95
Bạn thử cái sub này xem (làm theo kiểu record macro cho nên chắc là chưa tối ưu).
Để áp dụng được thì cần phải thỏa tất cả điều kiện sau:
1+ mỗi câu hỏi có 4 đáp án
2+ mỗi đáp án chỉ chiếm 1 dòng
3+ 4 đáp án chiếm 4 dòng kế tiếp nhau
4+ 4 đáp án bắt đầu bằng các ký tự “a.” “b.” c.” d.”
5+ số chạy vòng lặp đủ dư để chạy hết tất cả các dòng
6+ thêm vào cuối bài 4 dòng chứa các ký tự “zz”

Nếu không thỏa được các điều kiện trên thì sub này không dùng được; tùy tình trạng mà chỉnh sửa.
Mục 6+ là do tôi không biết chọn điểm cuối file để dừng vòng lặp; bạn chỉnh lại cho phù hợp.
Cách chọn dòng và chọn ký tự có vẻ thủ công nên vòng lặp có vẻ làm việc nhiều.
Tôi chạy thử khoảng 1.500 câu thì máy tôi mất chừng một phút.
Thử nhanh nên chẳng Option Explicit.

Sub Dong()
ActiveDocument.Range(0, 0).Select
For i = 1 To 50000
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
a = Selection
Selection.HomeKey
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
b = Selection
Selection.HomeKey
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
c = Selection
Selection.HomeKey
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
d = Selection
x = Left(a, 2) & Left(b, 2) & Left(c, 2) & Left(d, 2)
If x = "zzzzzzzz" Then Exit For
If x = "a.b.c.d." Then
y = a & b & c & d
y = Replace(y, Chr(13), "; ")
y = Left(y, Len(y) - 2)
Selection.MoveUp Unit:=wdLine, Count:=3
Selection.MoveDown Unit:=wdLine, Count:=4, Extend:=wdExtend
Selection.TypeText Text:=y
Else
Selection.MoveUp Unit:=wdLine, Count:=3
End If
Next i
MsgBox i
End Sub

42. "My friend was going to call me as soon as he arrived this morning, but he
didn't call." "He ....................... the train."
a. had to miss
b. should have missed
c. would have missed
d. must have missed
--> d
43. He wasn’t responsible. He wasn’t .............
a. blame
b. to blame
c. blaming
d. for blame
--> b
44. She went to a seaside resort because she was .................. on water-skiing.
a. keen
b. enthusiastic
c. interested
d. like
--> a

zz
zz
zz
zz
 
Bạn dùng thử cách này xem. Không dùng Macro nhưng cũng nhanh không kém. Làm theo từng bước như sau nhé:

Press Ctrl + h
Find what: ^pb.
Replace with: ; b.
Click Replace All

Làm tiếp và thay b lần lượt bằng cd
 
Bạn dùng thử cách này xem. Không dùng Macro nhưng cũng nhanh không kém. Làm theo từng bước như sau nhé:

Press Ctrl + h
Find what: ^pb.
Replace with: ; b.
Click Replace All

Làm tiếp và thay b lần lượt bằng cd
Nếu dạng trắc nghiệm bên dưới thì ta dùng kí tự nào thay thế nhỉ!

[FONT=&quot]19. The ship broke .............. and the people were drowned.[/FONT]
[FONT=&quot] a. out b. out of the sea[/FONT]
[FONT=&quot] c. into pieces d. to pieces[/FONT]
[FONT=&quot]20. ........ I have a car, I prefer to travel by train.[/FONT]
[FONT=&quot] a. In spite of b. Despite[/FONT]
[FONT=&quot] c. Because d. Although[/FONT]
[FONT=&quot]21. My brother sang ..............of all the pupils of the group.[/FONT]
[FONT=&quot] a. more beautifully b. the most beautifully[/FONT]
[FONT=&quot] c. less beautifully d. most beautifully[/FONT]
[FONT=&quot]22. I wish he .......... change his minds so often![/FONT]
[FONT=&quot] a. shouldn’t b. wouldn’t[/FONT]
[FONT=&quot] c. mightn’t d. couldn’t[/FONT]
 
Lần chỉnh sửa cuối:
Nếu dạng trắc nghiệm bên dưới thì ta dùng kí tự nào thay thế nhỉ!

[FONT=&quot]19. The ship broke .............. and the people were drowned.[/FONT]
[FONT=&quot] a. out b. out of the sea[/FONT]
[FONT=&quot] c. into pieces d. to pieces[/FONT]
[FONT=&quot]20. ........ I have a car, I prefer to travel by train.[/FONT]
[FONT=&quot] a. In spite of b. Despite[/FONT]
[FONT=&quot] c. Because d. Although[/FONT]
[FONT=&quot]21. My brother sang ..............of all the pupils of the group.[/FONT]
[FONT=&quot] a. more beautifully b. the most beautifully[/FONT]
[FONT=&quot] c. less beautifully d. most beautifully[/FONT]
[FONT=&quot]22. I wish he .......... change his minds so often![/FONT]
[FONT=&quot] a. shouldn’t b. wouldn’t[/FONT]
[FONT=&quot] c. mightn’t d. couldn’t[/FONT]
Thì cũng vậy thôi nhưng chỉ thay thế "^pc." bằng " c." thôi
 
Web KT

Bài viết mới nhất

Back
Top Bottom