Results 1 to 6 of 6

Modify VBA code to include additional columns

Threaded View

  1. #1
    Registered User
    Join Date
    11-03-2018
    Location
    Cumming, Ga
    MS-Off Ver
    2018
    Posts
    3

    Modify VBA code to include additional columns

    The following clears the data in column C and D when Column B changes. Need to expand this to include columns E-I. Doesn't seem like this should be that hard but I haven't been able to make it work yet. Thanks in advance!

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    'clear contents of dependent cells
    On Error Resume Next
    If Target.Validation.Type = 3 Then
      Application.EnableEvents = False
      Select Case Target.Column
        Case 2  'clear columns C and D
          Range(Target.Offset(0, 1), _
            Target.Offset(0, 2)).ClearContents
        Case 3  'clear column D
          Target.Offset(0, 1).ClearContents
      End Select
    End If
    
    exitHandler:
      Application.EnableEvents = True
      Exit Sub
    
    End Sub
    Last edited by jbolyard; 11-06-2018 at 09:46 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to modify a VBA code to include outlook signature
    By Chickman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-04-2017, 09:37 AM
  2. Modify Code to include search for second text
    By 3345james in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2016, 06:15 PM
  3. [SOLVED] Modify Code to Include More Columns
    By nirvehex in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-05-2015, 05:22 PM
  4. [SOLVED] Macro Code - Modify to include > or = to
    By SVTF in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-22-2014, 05:18 PM
  5. Help needed to modify the code to include the logic
    By reddys0909 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2013, 09:28 PM
  6. Modify code to include header formatting
    By msmick in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-11-2011, 07:41 PM
  7. Need help to modify code to include more than 1 Column
    By coreytroy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2007, 02:08 AM

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