+ Reply to Thread
Results 1 to 3 of 3

How to amend VBA code to make it more dynamic?

  1. #1
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    How to amend VBA code to make it more dynamic?

    Hi,

    I'm trying to automate the validation of our MI returns and I use the code below to perform one of the basic checks against the customer code and conditionally format it green if it is valid. The problem I'm experiencing is that each category team has a different supplier template although the header names are the same. How can I amend the code below so rather than starting in cell C2 the macro has to identify which cell has the column header 'customer code ' and effectively make that the C2 equivalent for this MI return.

    I hope that makes sense? Basically I want the macro to scan the header names across the columns in row 1, identify which is the 'customer code' and apply the conditional format from row 2 of that column to the bottom of the range.

    Thanks in advance,

    Snook

    HTML Code: 
    Last edited by The_Snook; 03-02-2016 at 06:14 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to amend VBA code to make it more dynamic?

    I do not have your data to test, but this code selects the desired range and you then need to apply the CF. I also assume you want to search for customer code in row 1 , if the code is different, you need to change it on the find line (Set rng = .Find("customer code", LookIn:=xlValues, lookat:=xlWhole)).
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: How to amend VBA code to make it more dynamic?

    Try this. I added a bit to the start of your code that should identify the header labeled "customer code".

    Please Login or Register  to view this content.

+ 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. Amend macro to make another list in column C
    By max8719 in forum Excel General
    Replies: 1
    Last Post: 02-07-2016, 02:33 PM
  2. [SOLVED] How to make the following code dynamic?
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-19-2015, 03:55 PM
  3. [SOLVED] Format cell via code and make formatting dynamic
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 01-23-2015, 02:10 PM
  4. Simply VBA code and make it dynamic
    By Rusty315 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2014, 02:49 AM
  5. I Want to know how I can make this formula into vba code for dynamic cell address
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2013, 02:41 PM
  6. [SOLVED] Make Static code Dynamic
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-05-2012, 11:09 AM
  7. trying to amend existing SUM to make it more selective
    By Woolmep in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-29-2009, 06:12 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