Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Macro1()
  2. '
  3. ' Macro1 Macro
  4. '
  5.  
  6. '
  7. '    With Selection.Interior
  8. '        .Pattern = xlSolid
  9. '        .PatternColorIndex = xlAutomatic
  10. '        .ThemeColor = xlThemeColorDark1
  11. '        .TintAndShade = 0
  12. '        .PatternTintAndShade = 0
  13. '    End With
  14. '    With Selection.Font
  15. '        .ThemeColor = xlThemeColorLight1
  16. '        .TintAndShade = 0
  17. '    End With
  18. '    Range("C13").Select
  19. '    ActiveCell.FormulaR1C1 = "aget"
  20. '    Range("C12").Select
  21. Range("A1", "E5").Delete
  22. i = 1
  23. bcol = 500
  24. tcol = 1
  25. Do While i <= 300
  26.     Range("A1", "E5").Select
  27.     If i <= 100 Then
  28.         Range("A1", "E5").value = "hmm"
  29.     ElseIf i > 100 And i <= 200 Then
  30.         Range("A1", "E5").value = "Hi how are you"
  31.     ElseIf i > 200 Then
  32.         Range("A1", "E5").value = "ending"
  33.     End If
  34.     Range("A1", "E5").EntireColumn.AutoFit
  35.     'Columns("A:A").EntireColumn.AutoFit
  36.    'Columns("B:B").EntireColumn.AutoFit
  37.    'Columns("C:C").EntireColumn.AutoFit
  38.    'Columns("D:D").EntireColumn.AutoFit
  39.    'Columns("E:E").EntireColumn.AutoFit
  40.    With Selection.Interior
  41.         .Color = bcol
  42.         End With
  43.     With Selection.Font
  44.         .Color = tcol
  45.         End With
  46. bcol = bcol + 1
  47. tcol = tcol + 1
  48. i = i + 1
  49. Loop
  50. Range("A1", "E5").Delete
  51. Range("A1").value = "Loop Executed:"
  52. Range("B1").value = i
  53. Range("C1").value = "times."
  54. Range("A2").value = "Author:"
  55. Range("B2").value = "Joshua C"
  56. Range("A3").Select
  57. ActiveCell.FormulaR1C1 = "=DATE(2010,10,31)"
  58. Range("B3").Select
  59. ActiveCell.FormulaR1C1 = "=TIME(20,28,0)"
  60. Range("A1", "Z1").EntireColumn.AutoFit
  61. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement