indongsaeng

VBA Gist - DAG

Aug 7th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub trans_test()
  2.    Workbooks("source.xlsx").Worksheets("Sheet1").Range("A1:F4").Copy Workbooks("destination.xlsx").Worksheets("Sheet1").Range("A1")
  3.    Dim rng As Range, cell As Range
  4.    Set rng = Workbooks("destination.xlsx").Worksheets("Sheet1").Range("A1:F4")
  5.    
  6.    For Each cell In rng
  7.     If cell.Value <= 10 Then
  8.         cell.Interior.Color = RGB(0, 0, 255)
  9.     ElseIf cell.Value <= 20 Then
  10.         cell.Interior.Color = RGB(255, 255, 0)
  11.    
  12.     ElseIf cell.Value <= 30 Then
  13.         cell.Interior.Color = RGB(0, 255, 255)
  14.     End If
  15.    Next cell
  16. End Sub
Add Comment
Please, Sign In to add comment