+ Reply to Thread
Results 1 to 2 of 2

Thread: Excel 2003-Changing Cells depending on Data entered

  1. #1
    Registered User
    Join Date
    10-20-2011
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    1

    Question Excel 2003-Changing Cells depending on Data entered

    i'm trying to create a spreadsheet where depending on what data is entered in one cell thats how the other cells get changed, that is, gray out and disabled. i have the following vbscript coded so far but this could be totally incorrect, it's just not working......any help will be appreciated.

    Private Sub Worksheet_Change(ByVal Target As Range)

    If ActiveCell.Column = 5 And ActiveCell.Row >= 7 Then
    If Target.Value = "X" Then
    ActiveSheet.Unprotect Password:="MyPassword"
    With ActiveCell.Offset(0, 5)
    .ClearContents
    .Interior.Color = RGB(192, 192, 192)
    .Locked = True
    End With
    ActiveSheet.Protect Password:="MyPassword"
    Else
    If Target.Value = "" Then
    ActiveSheet.Unprotect Password:="MyPassword"
    With ActiveCell.Offset(0, 5)
    .ClearContents
    .Interior.Color = RGB(255, 255, 255)
    .Locked = False
    End With
    ActiveSheet.Protect Password:="MyPassword"
    End If
    End If
    ElseIf ActiveCell.Column = 7 And ActiveCell.Row >= 7 Then
    If Target.Value = "X" Then
    ActiveSheet.Unprotect Password:="MyPassword"
    With ActiveCell.Offset(0, 3)
    .ClearContents
    .Interior.Color = RGB(192, 192, 192)
    .Locked = True
    End With
    ActiveSheet.Protect Password:="MyPassword"
    Else
    If Target.Value = "" Then
    ActiveSheet.Unprotect Password:="MyPassword"
    With ActiveCell.Offset(0, 3)
    .ClearContents
    .Interior.Color = RGB(255, 255, 255)
    .Locked = False
    End With
    ActiveSheet.Protect Password:="MyPassword"
    End If
    End If
    End If

    End Sub

    Thanking you in advance,
    Flukmanji

  2. #2
    Forum Moderator arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    4,374

    Re: Excel 2003-Changing Cells depending on Data entered

    Please put your code in code tags before the moderators ask you to do so. Then someone will surely help you out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0