+ Reply to Thread
Results 1 to 2 of 2

Code to insert text if value = true

  1. #1
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Donemana, NI
    MS-Off Ver
    Excel 2007
    Posts
    386

    Code to insert text if value = true

    Hi, I am looking code to insert text into a column based on the value in another, I am currently using the following vlookup code =VLOOKUP(N3,$AM$2:$AN$8,2,0) but have been finding it very slow when using a macro for the rest of the workbook, I have attached a copy of the workbook showing the code and what I am trying to achieve, I am also using the formula =INDEX(AB2:AK2,MATCH(REPT("z",255),AB2:AK2)) in column AL to show the last entry if possible could the code incorporate this also?
    Thanks in Advance
    Johnny
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Code to insert text if value = true

    Hi Burt_100,

    See the attached file which uses an Excel 'Scripting Dictionary' which can be used as a VBA replacement for VLOOKUP.
    See http://www.snb-vba.eu/VBA_Dictionary_en.html

    The code updates Columns 'AB' thru 'AH' and Column 'AL'. Columns 'AI' thru 'AK' are not used because you ran out of 'Contact Numbers'.

    My speculation is that this code will improve performance very slightly. I think the array formulas in columns 'N', 'P', etc. are probably your Bottleneck.

    In the Sheet 'Reminders' Code module:
    Please Login or Register  to view this content.
    In ordinary Code Module ModReminders:
    Please Login or Register  to view this content.
    It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
    Please Login or Register  to view this content.
    This option requires all variables to be declared and will give a compiler error for undeclared variables.

    Lewis

+ 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] .Visible property not remaining true (or even becoming true) when code runs.
    By SocratesJC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2015, 06:20 PM
  2. Insert text if date and text = true
    By Burt_100 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-11-2015, 04:56 AM
  3. [SOLVED] Help! 1 - Lookup specific text from column E and insert true/false - IF
    By KClem in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-06-2015, 06:38 PM
  4. Insert fuller text next to code
    By collinsc in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 01-14-2014, 10:30 AM
  5. [SOLVED] Insert text file into VBA code
    By barryleajo in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-11-2013, 01:18 PM
  6. How to insert text depending on code used?
    By -Nikki in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-12-2013, 08:43 AM
  7. What if scenario, TRUE insert text here.
    By simbalyon303 in forum Excel General
    Replies: 6
    Last Post: 09-28-2011, 06:39 PM

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