Format Cells Based On Current Position

  • Hey all, so basically I need help with a VBA code that can do the following.


    If you have a certain cell selected, it will format the next 5 cells including the cell selected a certain colour/format.


    How can I do this, ideas?


    Thanks!


    Possible e.g.


    Code
    Range(CurrentPosition, Range(CurrentPosition).offset(0, 4).Colorindex


    I dunno?

  • Re: Format Cells Based On Current Position (VBA Code)


    Hi jaylotheman,
    Nice to meet you.

    Code
    Dim CurrentPosition As Range
    Set CurrentPosition = ActiveCell
    With Range(CurrentPosition, CurrentPosition.Offset(0, 4))
    .Interior.Color = vbGreen
    End With


    Regards, junho

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!