Forum Discussion

Wonder Steak's avatar
Wonder Steak
Copper Contributor
Apr 12, 2018
Solved

marking data

Hello everybody, i'm looking for a way to automatically mark the numbers in the groups ( will be 10-15 groups in total ) with a color whenever i change the numbers on the right with group to group ma...
  • Logaraj Sekar's avatar
    Logaraj Sekar
    Apr 20, 2018

    Hi Wonder,

     

    Sorry for the delay. Have some work. Use the macro below in your excel sheet.

     

    Sub Macro1()
    Dim a, f, t As Integer

    If Range("M3").Value = "A" Then
    f = Range("N3").Value
    t = Range("O3").Value
    For i = f To t
    Range("P3").Select
    Selection.Copy
    Range("A3:C8").Select
    Selection.Find(What:=i, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
    ActiveCell.Offset(1, 0).Select
    ActiveCell.Offset(-1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Next i
    End If

    If Range("M4").Value = "B" Then
    f = Range("N4").Value
    t = Range("O4").Value
    For i = f To t
    Range("P4").Select
    Selection.Copy
    Range("E3:G8").Select
    Selection.Find(What:=i, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
    ActiveCell.Offset(1, 0).Select
    ActiveCell.Offset(-1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Next i
    End If

    If Range("M5").Value = "A to B" Then
    f = Range("N5").Value
    t = Range("O5").Value
    For i = f To 18
    Range("P5").Select
    Selection.Copy
    Range("A3:C8").Select
    Selection.Find(What:=i, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
    ActiveCell.Offset(1, 0).Select
    ActiveCell.Offset(-1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Next i
    For i = 1 To t
    Range("P5").Select
    Selection.Copy
    Range("E3:G8").Select
    Selection.Find(What:=i, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
    ActiveCell.Offset(1, 0).Select
    ActiveCell.Offset(-1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Next i
    End If
    End Sub

Resources