+ Reply to Thread
Results 1 to 4 of 4

Macro to give locations sequencially

  1. #1
    Forum Contributor
    Join Date
    01-13-2016
    Location
    Sheffield, England
    MS-Off Ver
    2016
    Posts
    216

    Macro to give locations sequencially

    Hi All,

    I am currently on with a project relaying out all our storage locations throughout the business
    I need to reflag all bins locations which if all typed in manually would take an absolute age.
    I am hoping one of you helpful lot within the community could help.

    My thought process was a form asking for the 1st location i.e. S001 and then the last location S200. These change dependant upon where within the business the location is.
    Then ask for the amount of sub locations within said locations i.e. A to F.

    The macro then would produce 4 identical sized flags per A4 sheet with the following on them as an example.

    *S001A*, *S001B*, *S001C* and so on until the criteria within the form has been met.

    The sizing of the font at this point and actual font are not a problem as I can alter that at a later stage when we have decided which barcode system we will be using.

    I am hoping someone can help as I have said this would take an age to manually type out and my VBA is not good enough to be able to do this.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Macro to give locations sequencially

    As you plan to print labels, the typical tool would be a MailMerge (built in Word). You just need to use labels not letters as a document type.
    And you need your data with *S001A*, *S001B*, *S001C* and so on in single database.
    This database would be easy to prepare with Excel.
    In A1 I'd write a column name (like "Code") (some header is needed for mailmerge) and then in cell A2 (and copy down as needed) the formula generating codes following your pattern, like:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I did it for just 4 ABCD but for 6 it could be

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And if you need for instance 6 for S001 but only 4 for S002 then you can generate all with this formula and then copy and paste special as values and remove unneeded rows of data.

    Then use this excel file as a source for mailmerge.

    I attach to this post the excel file and word document and a sample merged document will be attached to next post (limit of 2 attachnets per post on the forum)
    Attached Files Attached Files
    Last edited by Kaper; 01-11-2024 at 07:47 AM.
    Best Regards,

    Kaper

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Macro to give locations sequencially

    And the output looks like this

    Please note that previuos post was edited
    Attached Files Attached Files
    Last edited by Kaper; 01-11-2024 at 07:48 AM.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Macro to give locations sequencially

    PS. And if the number of sublocations is different each location, like:
    S001 4 sublocations
    S002 6
    S003 3
    S004 11
    and so on, to produce

    *S001A*
    *S001B*
    *S001C*
    *S001D*
    *S002A*
    *S002B*
    *S002C*
    *S002D*
    *S002E*
    *S002F*
    *S003A*
    *S003B*
    *S003C*
    *S004A*
    *S004B*
    *S004C*
    *S004D*
    *S004E*
    *S004F*
    *S004G*
    *S004H*
    *S004I*
    *S004J*
    *S004K*


    the easiest (for me) way to generate such a list will be by using Power Query - one of possible codes (mostly clicked-out in interface, except of list creation and concatenation of separate code parts:


    Please Login or Register  to view this content.
    You may change data in (blue) input table and right-click on ootput (breen) table and refresh it.
    Attached Files Attached Files

+ 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. Sorting alphanumerical characters sequencially.
    By jlbello in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-22-2016, 05:01 PM
  2. [SOLVED] Relative locations to absolute locations using VBA
    By lostest in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-17-2015, 06:30 PM
  3. Incorporating Google Map inside spreadsheet having Two locations to show locations
    By phanikumarbh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2015, 09:10 AM
  4. Replies: 0
    Last Post: 03-08-2015, 12:48 PM
  5. Macro to save csv in two different locations
    By njoneja in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-22-2012, 12:35 PM
  6. VB code to compare distances and give me a list of locations Closest to furthest
    By kal-el.Kanata in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2011, 03:33 PM
  7. Button to copy sheet, rename sheet sequencially.
    By foxgguy2005 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-17-2005, 09:05 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