hỏi về thống kê tên sheet cùa file hiện hành (1 người xem)

Liên hệ QC

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

hoangminhgiam

Thành viên mới
Tham gia
24/2/13
Bài viết
13
Được thích
0
mình muốn viết code ghi tất cả tên các sheet của file exel hiện hành lên cột A của sheet ketqua.
làm ơn giúp mình.
 
mình muốn viết code ghi tất cả tên các sheet của file exel hiện hành lên cột A của sheet ketqua.
làm ơn giúp mình.
Mã:
[COLOR=#007700][FONT=monospace]Private [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Sub Worksheet_Activate[/FONT][/COLOR][COLOR=#007700][FONT=monospace]()
[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Dim sh [/FONT][/COLOR][COLOR=#007700][FONT=monospace]As [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Worksheet[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]i
[/FONT][/COLOR][COLOR=#007700][FONT=monospace]For [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Each sh In Worksheets
   i [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]i [/FONT][/COLOR][COLOR=#007700][FONT=monospace]+ [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1
   Cells[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]i[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) = [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]sh[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Name
Next
[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]a1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]CurrentRegion[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Sort key1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]:=[[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]a1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]], [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]header[/FONT][/COLOR][COLOR=#007700][FONT=monospace]:=[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1
End Sub


[/FONT][/COLOR][COLOR=#007700][FONT=monospace]Private [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Sub Worksheet_BeforeDoubleClick[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]ByVal Target [/FONT][/COLOR][COLOR=#007700][FONT=monospace]As [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Range[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Cancel [/FONT][/COLOR][COLOR=#007700][FONT=monospace]As [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Boolean[/FONT][/COLOR][COLOR=#007700][FONT=monospace])
   [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Sheets[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Target[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Value[/FONT][/COLOR][COLOR=#007700][FONT=monospace]).[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Select
End Sub [/FONT][/COLOR]

Ch
ép code này vào sheet KetQua
Tham khảo thêm
http://www.giaiphapexcel.com/forum/...p-xếp-các-Sheet-trong-một-file-theo-Anphabet!
 
Lần chỉnh sửa cuối:
Upvote 0

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

Back
Top Bottom