Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I categorise answers in excel? | Excel Worksheet Functions | |||
how do i set up a list of customers in excell for mail merge | Excel Discussion (Misc queries) | |||
How many different customers in a list? | Excel Worksheet Functions | |||
Macros not appearing in the Tools Macro Macros list | Excel Programming | |||
List the Macros that can be executed from Tools-Macros | Excel Programming |