Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default using macros to categorise a list of customers

Im trying to use macros to separate information on different customers. I
have all the information on an excel spreadsheet and need to separate
customers into four different categories. Customers with the company name
beginning A to GR, then GS to SA, SB to THEC and THED to Z. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default using macros to categorise a list of customers

The following macro examines a name stored in cell A1 and puts a catagory
number in cell B1. The macro uses (Z100:Z106) as a working area. You can
pick any column of 7 unused cells. The catagory is the alphabetic
(dictionary) position:

1 - before GR
2 - after GR, before GS
3 - after GS, before SA
4 - after SA, before SB
5 - after SB, before THEC
6 - after THEC, before THED
7 - after THED

Sub katagory()

' gsnuxx

Set workarea = Range("Z100")
v = Range("A1").Value
workarea.Offset(0, 0).Value = "GR"
workarea.Offset(1, 0).Value = "GS"
workarea.Offset(2, 0).Value = "SA"
workarea.Offset(3, 0).Value = "SB"
workarea.Offset(4, 0).Value = "THEC"
workarea.Offset(5, 0).Value = "THED"
workarea.Offset(6, 0).Value = v
Set r = Range(workarea, workarea.Offset(6, 0))
r.Sort key1:=workarea

For i = 1 To 7
If workarea.Offset(i - 1, 0).Value = v Then
Range("B1").Value = i
Exit Sub
End If
Next

End Sub
--
Gary''s Student
gsnu200711


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I categorise answers in excel? yanick Excel Worksheet Functions 2 April 18th 07 04:54 PM
how do i set up a list of customers in excell for mail merge Redford Excel Discussion (Misc queries) 3 August 26th 05 04:53 PM
How many different customers in a list? cathcarr1 Excel Worksheet Functions 4 July 14th 05 01:02 PM
Macros not appearing in the Tools Macro Macros list hglamy[_2_] Excel Programming 5 October 24th 03 09:10 AM
List the Macros that can be executed from Tools-Macros Rob Bovey Excel Programming 1 July 10th 03 05:34 PM


All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"