+ Reply to Thread
Results 1 to 2 of 2

want to be able to multiselct in multiple columns, currently can the code only allows 1

  1. #1
    Registered User
    Join Date
    09-26-2024
    Location
    texas
    MS-Off Ver
    13
    Posts
    1

    want to be able to multiselct in multiple columns, currently can the code only allows 1

    How would I correct this code to be able to have it work for multiple columns?�*



    Private Sub Worksheet_Change(ByVal Target As Range)


    Dim Oldvalue As String
    Dim Newvalue As String
    Application.EnableEvents = True
    On Error GoTo Exitsub
    Const rngA = "U6:U468" Or "V6:V468"
    If Not Intersect(Target, Target.Parent.Range(rngA)) Is Nothing Then
    If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
    GoTo Exitsub
    Else: If Target.Value = "" Then GoTo Exitsub Else
    Application.EnableEvents = False
    Newvalue = Target.Value
    Application.Undo
    Oldvalue = Target.Value
    If Oldvalue = "" Then
    Target.Value = Newvalue
    Else
    If InStr(1, Oldvalue, Newvalue) = 0 Then
    Target.Value = Oldvalue & vbNewLine & Newvalue
    Else:
    Target.Value = Oldvalue
    End If
    End If
    End If
    End If
    Application.EnableEvents = True

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: want to be able to multiselct in multiple columns, currently can the code only allows

    Try:

    Please Login or Register  to view this content.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need fix for VBA Code to Custom Sort multiple columns that includes DATE columns
    By Kirk3737 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2020, 02:35 PM
  2. VBA code multiple rows to multiple columns transfromation
    By belpheghor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-01-2017, 05:49 AM
  3. [SOLVED] How to get multiple names columns using below code
    By rajeshn_in in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-03-2017, 01:10 AM
  4. VBA Code to compare/match multiple columns in one sheet with multiple columns in another
    By cellsearch123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2016, 09:25 AM
  5. Export multiselct listbox with nine columns
    By stewart1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-08-2014, 03:52 PM
  6. Replies: 6
    Last Post: 02-28-2014, 09:34 AM
  7. [SOLVED] Code for multiple columns and rows
    By ram in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2006, 03:40 PM

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.6.0 RC 1