Код |
---|
'Program Name: sixteen 'Purpose: Entertainment puzzle game 'Author: Mikhail I. 'Country: Russian Federation 'Date: 7.12.2009 'Version: 1.0 'File Size: ... Private Sub Worksheet_Activate() Columns("A:A").Select Selection.ColumnWidth = 8 Columns("B:B").Select Selection.ColumnWidth = 1 Columns("C:H").Select Selection.ColumnWidth = 8 Columns("I:I").Select Selection.ColumnWidth = 1 Rows("1:1").Select Selection.RowHeight = 40 Rows("2:2").Select Selection.RowHeight = 3 Rows("3:10").Select Selection.RowHeight = 40 ActiveWindow.SmallScroll Down:=1 Rows("11:11").Select Selection.RowHeight = 1 ActiveWindow.ScrollRow = 1 Range("C3").Select ActiveCell.FormulaR1C1 = "o" Range("B3").Select ActiveCell.FormulaR1C1 = "o" Range("B4").Select ActiveCell.FormulaR1C1 = "o" Range("C4").Select ActiveCell.FormulaR1C1 = "o" Range("C5").Select ActiveCell.FormulaR1C1 = "o" Range("B5").Select ActiveCell.FormulaR1C1 = "o" Range("B6").Select ActiveCell.FormulaR1C1 = "o" Range("B7").Select ActiveCell.FormulaR1C1 = "o" Range("C7").Select ActiveCell.FormulaR1C1 = "o" Range("B8").Select ActiveCell.FormulaR1C1 = "o" Range("C8").Select ActiveCell.FormulaR1C1 = "o" Range("B9").Select ActiveCell.FormulaR1C1 = "o" Range("C9").Select ActiveCell.FormulaR1C1 = "o" Range("H9").Select ActiveCell.FormulaR1C1 = "o" Range("I9").Select ActiveCell.FormulaR1C1 = "o" Range("H8").Select ActiveCell.FormulaR1C1 = "o" Range("I8").Select ActiveCell.FormulaR1C1 = "o" Range("H7").Select ActiveCell.FormulaR1C1 = "o" Range("I7").Select ActiveCell.FormulaR1C1 = "o" Range("I6").Select ActiveCell.FormulaR1C1 = "o" Range("I5").Select ActiveCell.FormulaR1C1 = "o" Range("H5").Select ActiveCell.FormulaR1C1 = "o" Range("I4").Select ActiveCell.FormulaR1C1 = "o" Range("H4").Select ActiveCell.FormulaR1C1 = "o" Range("I3").Select ActiveCell.FormulaR1C1 = "o" Range("H3").Select ActiveCell.FormulaR1C1 = "o" Range("A1").Select Range("D1").Select ActiveCell.FormulaR1C1 = "/\" Range("E1").Select ActiveCell.FormulaR1C1 = "/\" Range("F1").Select ActiveCell.FormulaR1C1 = "/\" Range("G1").Select ActiveCell.FormulaR1C1 = "/\" Range("D10").Select ActiveCell.FormulaR1C1 = "\/" Range("E10").Select ActiveCell.FormulaR1C1 = "\/" Range("F10").Select ActiveCell.FormulaR1C1 = "\/" Range("G10").Select ActiveCell.FormulaR1C1 = "\/" Range("D1:G1,D10:G10").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With With Selection.Font .Name = "Arial Black" .Size = 36 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .TintAndShade = 0 .ThemeFont = xlThemeFontNone End With Union(Range( _ "I4,I3,H3,I2,H2,G2,F2,E2,D2,C2,B2,B1:I1,B3,C3,B4,C4,B5,C5,B6,B7,C7,B8,C8,B9,C9,B10,C10,D10,E10,F10,G10,H10" _ ), Range("I10,I9,H9,H8,I8,I7,H7,I6,I5,H5,H4")).Select Range("B2").Activate With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 32768 .TintAndShade = 0 .PatternTintAndShade = 0 End With Range("B3:B9,C3,C4,C5,C7,C8,C9,H9,I9,I8,H8,H7,I7,I6,I5,H5,H4,I4,I3,H3").Select Range("H3").Activate With Selection.Font .Color = -16744448 .TintAndShade = 0 End With Range("D3").Select ActiveCell.FormulaR1C1 = "1" Range("E3").Select ActiveCell.FormulaR1C1 = "2" Range("F3").Select ActiveCell.FormulaR1C1 = "3" Range("G3").Select ActiveCell.FormulaR1C1 = "4" Range("D4").Select ActiveCell.FormulaR1C1 = "5" Range("E4").Select ActiveCell.FormulaR1C1 = "6" Range("F4").Select ActiveCell.FormulaR1C1 = "7" Range("G4").Select ActiveCell.FormulaR1C1 = "8" Range("D5").Select ActiveCell.FormulaR1C1 = "9" Range("E5").Select ActiveCell.FormulaR1C1 = "10" Range("F5").Select ActiveCell.FormulaR1C1 = "11" Range("G5").Select ActiveCell.FormulaR1C1 = "12" Range("D6").Select ActiveCell.FormulaR1C1 = "13" Range("E6").Select ActiveCell.FormulaR1C1 = "14" Range("F6").Select ActiveCell.FormulaR1C1 = "15" Range("G6").Select ActiveCell.FormulaR1C1 = "16" Range("A1").Select Range("D3:G9,C6,H6").Select Range("H6").Activate With Selection.Font .Name = "Arial Black" .Size = 27 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .TintAndShade = 0 .ThemeFont = xlThemeFontNone End With With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Range("D1:G10,C6,H6").Select Range("H6").Activate With Selection.Font .Color = -13382605 .TintAndShade = 0 End With Range("A1").Select End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error GoTo metka1 If Target.Cells.Value = "/\" Then Target.Cells.Offset(1, 0).Select If Cells(3, 4) = Empty And Cells(3, 5) = Empty And Cells(3, 6) = Empty And Cells(3, 7) = Empty And Cells(4, 4) = Empty And Cells(4, 5) = Empty And Cells(4, 6) = Empty And Cells(4, 7) = Empty And Cells(5, 4) = Empty And Cells(5, 5) = Empty And Cells(5, 6) = Empty And Cells(5, 7) = Empty Then For i = 6 To 9 For j = 4 To 7 Cells(i - 1, j).Value = Cells(i, j).Value Cells(i, j).Value = Empty Next j Next i Exit Sub End If If Cells(3, 4) = Empty And Cells(3, 5) = Empty And Cells(3, 6) = Empty And Cells(3, 7) = Empty And Cells(4, 4) = Empty And Cells(4, 5) = Empty And Cells(4, 6) = Empty And Cells(4, 7) = Empty And Cells(9, 4) = Empty And Cells(9, 5) = Empty And Cells(9, 6) = Empty And Cells(9, 7) = Empty Then For i = 5 To 8 For j = 4 To 7 Cells(i - 1, j).Value = Cells(i, j).Value Cells(i, j).Value = Empty Next j Next i Exit Sub End If If Cells(3, 4) = Empty And Cells(3, 5) = Empty And Cells(3, 6) = Empty And Cells(3, 7) = Empty And Cells(8, 4) = Empty And Cells(8, 5) = Empty And Cells(8, 6) = Empty And Cells(8, 7) = Empty And Cells(9, 4) = Empty And Cells(9, 5) = Empty And Cells(9, 6) = Empty And Cells(9, 7) = Empty Then For i = 4 To 7 For j = 4 To 7 Cells(i - 1, j).Value = Cells(i, j).Value Cells(i, j).Value = Empty Next j Next i Exit Sub End If End If If Target.Cells.Value = "\/" Then Target.Cells.Offset(1, 0).Select If Cells(7, 4) = Empty And Cells(7, 5) = Empty And Cells(7, 6) = Empty And Cells(7, 7) = Empty And Cells(8, 4) = Empty And Cells(8, 5) = Empty And Cells(8, 6) = Empty And Cells(8, 7) = Empty And Cells(9, 4) = Empty And Cells(9, 5) = Empty And Cells(9, 6) = Empty And Cells(9, 7) = Empty Then For j = 4 To 7 Cells(7, j).Value = Cells(6, j) Cells(6, j).Value = Empty Next j For j = 4 To 7 Cells(6, j).Value = Cells(5, j) Cells(5, j).Value = Empty Next j For j = 4 To 7 Cells(5, j).Value = Cells(4, j) Cells(4, j).Value = Empty Next j For j = 4 To 7 Cells(4, j).Value = Cells(3, j) Cells(3, j).Value = Empty Next j Exit Sub End If If Cells(3, 4) = Empty And Cells(3, 5) = Empty And Cells(3, 6) = Empty And Cells(3, 7) = Empty And Cells(8, 4) = Empty And Cells(8, 5) = Empty And Cells(8, 6) = Empty And Cells(8, 7) = Empty And Cells(9, 4) = Empty And Cells(9, 5) = Empty And Cells(9, 6) = Empty And Cells(9, 7) = Empty Then For j = 4 To 7 Cells(8, j).Value = Cells(7, j) Cells(7, j).Value = Empty Next j For j = 4 To 7 Cells(7, j).Value = Cells(6, j) Cells(6, j).Value = Empty Next j For j = 4 To 7 Cells(6, j).Value = Cells(5, j) Cells(5, j).Value = Empty Next j For j = 4 To 7 Cells(5, j).Value = Cells(4, j) Cells(4, j).Value = Empty Next j Exit Sub End If If Cells(3, 4) = Empty And Cells(3, 5) = Empty And Cells(3, 6) = Empty And Cells(3, 7) = Empty And Cells(4, 4) = Empty And Cells(4, 5) = Empty And Cells(4, 6) = Empty And Cells(4, 7) = Empty And Cells(9, 4) = Empty And Cells(9, 5) = Empty And Cells(9, 6) = Empty And Cells(9, 7) = Empty Then For j = 4 To 7 Cells(9, j).Value = Cells(8, j) Cells(8, j).Value = Empty Next j For j = 4 To 7 Cells(8, j).Value = Cells(7, j) Cells(7, j).Value = Empty Next j For j = 4 To 7 Cells(7, j).Value = Cells(6, j) Cells(6, j).Value = Empty Next j For j = 4 To 7 Cells(6, j).Value = Cells(5, j) Cells(5, j).Value = Empty Next j Exit Sub End If End If If Target.Address = "$C$6" Or Target.Address = "$D$6" Or Target.Address = "$E$6" Or Target.Address = "$F$6" Or Target.Address = "$G$6" Or Target.Address = "$H$6" Then If Target.Cells.Offset(0, -1) = Empty Then Target.Cells.Offset(0, -1).Value = Target.Cells.Value Target.Cells.Value = Empty End If If Target.Cells.Offset(0, 1) = Empty Then Target.Cells.Offset(0, 1).Value = Target.Cells.Value Target.Cells.Value = Empty End If End If If Target.Address = "$D$3" Or Target.Address = "$E$3" Or Target.Address = "$F$3" Or Target.Address = "$G$3" Or Target.Address = "$D$4" Or Target.Address = "$E$4" Or Target.Address = "$F$4" Or Target.Address = "$G$4" Or Target.Address = "$D$5" Or Target.Address = "$E$5" Or Target.Address = "$F$5" Or Target.Address = "$G$5" Or Target.Address = "$D$7" Or Target.Address = "$E$7" Or Target.Address = "$F$7" Or Target.Address = "$G$7" Or Target.Address = "$D$8" Or Target.Address = "$E$8" Or Target.Address = "$F$8" Or Target.Address = "$G$8" Or Target.Address = "$D$9" Or Target.Address = "$E$3" Or Target.Address = "$F$9" Or Target.Address = "$G$9" Then If Target.Cells.Offset(0, 1) = Empty Then Target.Cells.Offset(0, 1).Value = Target.Cells.Value Target.Cells.Value = Empty End If If Target.Cells.Offset(0, -1) = Empty Then Target.Cells.Offset(0, -1).Value = Target.Cells.Value Target.Cells.Value = Empty End If End If metka1: End Sub |
Sixteen Puzzle Game, (игра шестнашки)
Макрос копирования файла из одной папки в другую с возможностью выбора папки для сохранения
05.03.2022 11:53:17
|
|||||
|
Нестандартное (побайтное) копирование файлов средствами VBA
08.05.2021 15:27:59
'кому-то это нужно...
|
|||
|
Переименование файлов Excel в папке
Сетевая игра пинг-понг, кодинг пещерного человека
Как открывать файлы поочередно по возрастанию имени?
Макрос копирования файла из одной папки в другую с возможностью выбора папки для сохранения
03.04.2020 08:43:04
'Дубликатор. Если нужно скопировать не один файл, а несколько
Изменено: |
|||
|
Таблицы Шульте. Тренируем периферическое зрение, кодинг пещерного человека
Чат, кодинг пещерного человека
Таблицы Шульте. Тренируем периферическое зрение, кодинг пещерного человека
06.03.2020 20:43:02
просто не знаю как администрация ресурса отнесётся к тому что будет закачано много почти одинаковых файлов. А доделать конечно не сложно. |
|||||
|
Таблицы Шульте. Тренируем периферическое зрение, кодинг пещерного человека
Таблицы Шульте. Тренируем периферическое зрение, кодинг пещерного человека
Сетевая игра пинг-понг, кодинг пещерного человека
интернет радиоприёмник
Игра "ход конём"
Игра "ход конём"
12.07.2019 17:43:18
|
|||
|
Игра пятнашки с перемешиванием ячеек
16.02.2019 14:07:29
Крутая реализация. Проще и быстрее, - согласен... Но перемешивание осуществляется рандомно и расклад сходится не всегда. А хотелось бы, чтобы сходился. Я читал где-то что нужно, чтобы количество итераций было чётным, но полностью не разобрался. Вот к примеру на сайте
|
|
|
Как программно добавить форму, Может кому-нибудь пригодится
Игра пятнашки с перемешиванием ячеек
04.02.2019 20:42:04
Изменено: |
|||
|