+ Reply to Thread
Results 1 to 2 of 2

VBA Code

Hybrid View

jgoe VBA Code 02-15-2022, 01:22 PM
TMS Re: VBA Code 02-15-2022, 03:38 PM
  1. #1
    Registered User
    Join Date
    02-09-2022
    Location
    Florida
    MS-Off Ver
    365
    Posts
    1

    VBA Code

    Hi Everyone,
    I am new in learning VBA. I am trying to find a way to create code to perform the following function.

    In tab OID, when the cell Submitted date is updated with a date & the Auto Refill = Y, then it will duplicate the record on an additional row with the due date updated by either a year, quarter or month, the frequency for that Report ID is located on the other tab RID.

    I put code in the Worksheet SelctionChange; This is only a test code. I would want a code for the above logic.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    'Sets a variable to a proper range for later testing
    Dim KeyCells As Range
    Dim myColumn As ListObject
    Set myColumn = ActiveSheet.ListObjects("tbl_OID")
    Set KeyCells = myColumn.ListColumns(10).DataBodyRange

    'Indentation is funky but it'd break when I'd mess with it.
    If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
    'Section only triggers if within the designated range.
    MsgBox "Change in cell " & Target.Address
    End If


    End Sub
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,453

    Re: VBA Code

    I think you want Worksheet_Change not Worksheet_SelectionChange
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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. [SOLVED] Code to display text & code in a combo list, but display only code when selected
    By kdestef1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2019, 06:07 PM
  2. [SOLVED] Need help with VBA code. Tons of code seperated in two, second part of code doesn't work.
    By FragaGeddon in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-30-2015, 11:46 AM
  3. [SOLVED] Pattern Building VBA Code - Working code, would like to use cleaner code
    By Benisato in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2015, 03:05 PM
  4. [SOLVED] Excel VB code. Message pops up while code running asking question. Code must not wait.
    By Heinrich Venter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-28-2014, 06:10 AM
  5. [SOLVED] VBA code for assigning a numeric code to text; then numeric code populates table
    By cteaster in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2014, 08:01 PM
  6. Replies: 2
    Last Post: 03-09-2013, 04:30 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