+ Reply to Thread
Results 1 to 6 of 6

Using VBA Code to sort my data automatically

  1. #1
    Registered User
    Join Date
    10-18-2012
    Location
    Portmore, Jamaica
    MS-Off Ver
    Excel 2007
    Posts
    5

    Question Using VBA Code to sort my data automatically

    Good Day, let me jus kick it off right away, I am creating a list of criminal records for persons who has one or not and need a VBA Code to auto sort by surnames amount other things, Fig 1 is a sample data

    MY PROJ.jpg

    1st- I want my Column A to Sort Automatically in ascending order whenever I add a new row of data in row 7, 8 and so on, (table is not sorted now)
    2nd-My Range is A1:H5000
    3rd- Column F and G must not have any duplicates allowed
    4th- In column F when I type 0001 or 2071, I want the letter T to automatically add without me typing it first.
    5th- In column G when I type 12001973 or 08912010 I want the symbol - to automatically placed between to numbers as above.
    6th- Row 1 is my header row and is frozen

    Appreciate the assistance please as I have tried several codes without success(am a newbie to VBA Codes). Respect to all who have shown interest here, thanks.
    Last edited by ssincerely; 01-10-2013 at 12:49 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Using VBA Code to sort my data automatically

    Hi

    Check this out:

    Please Login or Register  to view this content.
    In the sheet, enter all the details. In col F do not enter "T" just the numbers and in col G do not enter the "-" sign. enter only the nuumbers. After entering the last column ie. "Results" continue pressing the TAB key and move to col I. There you will see all the changes that you wanted.
    Attached Files Attached Files
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Using VBA Code to sort my data automatically

    Sorry I forgot this:
    3rd- Column F and G must not have any duplicates allowed

    will fix that later..

  4. #4
    Registered User
    Join Date
    10-18-2012
    Location
    Portmore, Jamaica
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Using VBA Code to sort my data automatically

    Thanks man, it works like a charm, thanks again. waiting though on the 3rd and 6th task although I can manipulate it by doing it from the menus but not from the VBA so I'll wait on you, Respect everytime.

  5. #5
    Registered User
    Join Date
    10-18-2012
    Location
    Portmore, Jamaica
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Using VBA Code to sort my data automatically

    I tried changing the table with some formats and add colours, froze the heading and somehow the data didn't sort automatically, however when I run the macro it did. I would prefer auto though but is it that whenever I change the format of the sheet it will affect the code?

    Quote Originally Posted by ssincerely View Post
    Thanks man, it works like a charm, thanks again. waiting though on the 3rd and 6th task although I can manipulate it by doing it from the menus but not from the VBA so I'll wait on you, Respect everytime.

  6. #6
    Registered User
    Join Date
    10-18-2012
    Location
    Portmore, Jamaica
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Using VBA Code to sort my data automatically

    Thanks man, it works like a charm, thanks again. waiting though on the 3rd and 6th task although I can manipulate it by doing it from the menus but not from the VBA so I'll wait on you, Respect everytime.

    I tried changing the table with some formats and add colours, froze the heading and somehow the data didn't sort automatically, however when I run the macro it did. I would prefer auto though but is it that whenever I change the format of the sheet it will affect the code?

    Quote Originally Posted by jraj1106 View Post
    Sorry I forgot this:
    3rd- Column F and G must not have any duplicates allowed

    will fix that later..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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