Results 1 to 2 of 2

Thread: Please help with my excel problem

  1. #1

    Please help with my excel problem



    Register for a FREE account, and/
    or Log in to avoid these ads!

    I have a Spread sheet that I need help with. Ok here is an example of what I would like to accomplish Cell A1 = 123456 B1 = 10/13/13 C1 = Ten computers What I need to happen is when Cell A1 value is removed I need B1 and C1 to become empty as well. Information in B1 and C1 is entered manually. I have a lot of A1 cells in my spread sheet and they information changes daily. It is important that when A1 information is removed that B1 and C1 information also is removed automatically. Any help would be great Thank you

  2. #2
    Conjurer royUK's Avatar
    Join Date
    Mar 2011
    Location
    Derbyshire, UK
    Posts
    155
    Articles
    0
    Excel Version
    most versions
    Do you mean that you want this to clear B1 & C1 on multiple sheets?

    Code:
    
    Option Explicit
    
    
    
    
    '---------------------------------------------------------------------------------------
    ' Procedure : Workbook_SheetChange
    ' Author    : Roy Cox (royUK)
    ' Website   : www.Excel -it.com
    ' Date      : 27/04/2013
    ' Purpose   : If A1 is cleared, B1 & C1 are also cleared
    '---------------------------------------------------------------------------------------
    '
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
        If Target.Address <> "$A$1" Then Exit Sub
    
    
        If Len(Target) = 0 Then
            Target.Offset(, 1).ClearContents
            Target.Offset(, 2).ClearContents
        End If
    End Sub
    Workbook Event code should be added to the workbook code module:


    Copy the Excel VBA code that you want to use
    Select the workbook in which you want to store the code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    In the Project Explorer, find your workbook, and open the list of Microsoft Excel Objects
    Right-click on the ThisWorkbook object, and choose View Code
    Where the cursor is flashing, choose Edit | Paste
    Last edited by royUK; 2013-04-27 at 10:01 AM.
    Hope that helps

    Roy

Posting Permissions

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