+ Reply to Thread
Results 1 to 6 of 6

VBA to assign band as per the numbers

  1. #1
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    VBA to assign band as per the numbers

    Hi,
    I have a data in Sheet "List". In column G, I have numberic values. In sheet "Band", I have types of Band in column N (Band_1), P (Band_2), R (Band_3) and T (Band_4).

    I Sheet List against the numberic values in G, Want to insert band (number bracket) in resctive column i.e, J, L, N and Q

    Please refer sheet "Result" for final output.
    Attached Files Attached Files

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA to assign band as per the numbers

    If you adjust your band table to use the lower limit as a lookup value, you can use VLOOKUP like this:

    Please Login or Register  to view this content.
    See the attached.

    WBD
    Attached Files Attached Files
    Office 365 on Windows 11, looking for rep!

  3. #3
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: VBA to assign band as per the numbers

    Hi,
    Thank you very much for your reply.

    Instead of Formula I, Need in a VB Code.

    Coz I need to add the same in my other VB code.

    the Code should run till the lsat row of Serial number mentioned on Column A.
    Last edited by saravanan1981; 10-08-2019 at 10:36 AM.

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA to assign band as per the numbers

    OK. With the book I attached earlier, add this code:

    Please Login or Register  to view this content.
    WBD

  5. #5
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: VBA to assign band as per the numbers

    It shows in error in below line

    Cells(thisRow, thisCol).Value = Application.VLookup(Cells(thisRow, "G").Value, Range(Cells(1, thisCol).Value), 2, True)

  6. #6
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA to assign band as per the numbers

    What is the error? When it errors, use Ctrl+G to bring up the immediate window and type this:

    Please Login or Register  to view this content.
    Hit return and tell me what it shows.

    WBD

+ 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. Macro insert multiple sheet and insert age band based on numbers
    By saravanan1981 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-01-2017, 01:47 PM
  2. [SOLVED] Formula or vba to assign a priceing band to UK postal code.
    By A440 in forum Excel General
    Replies: 15
    Last Post: 11-24-2015, 02:25 PM
  3. [SOLVED] Assign incremental numbers to matching Invoice numbers
    By berger01 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-06-2013, 10:54 AM
  4. [SOLVED] how can i assign i set of numbers (1-16) without repeating them?
    By Stew in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  5. [SOLVED] how can i assign i set of numbers (1-16) without repeating them?
    By N Harkawat in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 04:05 AM
  6. [SOLVED] how can i assign i set of numbers (1-16) without repeating them?
    By Stew in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  7. Assign numbers 101 - 106
    By hotherps in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2005, 10:17 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