+ Reply to Thread
Results 1 to 3 of 3

When a cell is filled or cleared cause an action in the same row as the changed cell

Hybrid View

JCMus When a cell is filled or... 02-16-2012, 10:58 AM
Pichingualas Re: When a cell is filled or... 02-16-2012, 11:33 AM
watersev Re: When a cell is filled or... 02-16-2012, 12:02 PM
  1. #1
    Registered User
    Join Date
    02-15-2012
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    9

    When a cell is filled or cleared cause an action in the same row as the changed cell

    Hi. I would like to cause the appearance of some cells to change based upon a cell in the same row being filled or cleared.
    i.e.
    1. If cell B9 is filled then put a border around cells AX9:BY9, fill those cells yellow and scroll column AX to the left of the screen (Col A:L are frozen). If B9 is cleared then undo the changes; no border, no fill, scroll screen back.
    2. If cell B10 is filled or cleared repeat above actions for AX10:BY10.
    3. Repeat down to row 1000 (B11, B12...B1000).

    Much thanks!
    JCMus

  2. #2
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: When a cell is filled or cleared cause an action in the same row as the changed c

    Use this code:

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        
        Dim val As String
        
        Application.ScreenUpdating = False
        
        If Target.Column = 2 And Target.Row >= 9 And Target.Row <= 1000 Then
            val = Target.Value
            If val <> "" Then
                With Range("AX" & CStr(Target.Row) & ":BY" & CStr(Target.Row))
                    .Borders.LineStyle = xlContinuous
                    .Interior.Color = 65535
                End With
                ActiveWindow.ScrollColumn = 50
            Else
                With Range("AX" & CStr(Target.Row) & ":BY" & CStr(Target.Row))
                    .Borders.LineStyle = xlNone
                    .Interior.Pattern = xlNone
                End With
                ActiveWindow.ScrollColumn = 13
            End If
        Else
            Exit Sub
        End If
    End Sub
    Paste it on the corresponding sheet tho, like in the example. Check it to see the working macro.

    Example1.xlsm

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: When a cell is filled or cleared cause an action in the same row as the changed c

    hi JCMus, if scrolling can be omitted, you can use Conditional Format and do not use VB at all, check attachment, put anything in B2, check result in E2:M2, clear B2.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1