Курсовая работа: Компьютерная подготовка
count = counter
EndFunction
sortForm
PrivateSub UserForm_Activate()
OKButton.SetFocus
EndSub
PrivateSub CancelButton_Click()
sortForm.Hide
EndSub
PrivateSub OKButton_Click()
Dim sht As Worksheet
Dim rng As Range
Set sht = ThisWorkbook.ActiveSheet
Set rng = sht.Range(sht.Cells(5, 1), sht.Cells(65536, 1).End(xlUp).Offset(, 7))
If NameOption.Value Then
' сортироватьпоФИО
rng.sort Key1:=sht.Columns("A"), Order1:=xlAscending, Key2:=sht.Columns("B"), Order2:=xlAscending, Key3:=sht.Columns("C"), Order3:=xlAscending, Header:=xlNo
Else
If AddressOption.Value Then
' сортироватьпоадресу
rng.sort Key1:=sht.Columns("D"), Order1:=xlAscending, Key2:=sht.Columns("E"), Order2:=xlAscending, Key3:=sht.Columns("F"), Order3:=xlAscending, Header:=xlNo
Else
' сортироватьпотелефону
rng.sort Key1:=sht.Columns("G"), Order1:=xlAscending, Header:=xlNo
EndIf
EndIf
sortForm.Hide
EndSub
Module1