Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default writing macro to match the group and age

i am trying to write a macro to match age &group

for example I am 19 and I am in the group 1 so I am trying to write
the macro to give the answer of which group I belong to

group 1:0-20 ages
group 2 :21-30 ages
group 3:31-40 ages
group 4: 41-50 ages

thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default writing macro to match the group and age

On Sep 21, 5:07*pm, ipek wrote:
i am trying to write a macro to match age &group

for example I am 19 and I am in the group 1 so I am trying to write
the macro to give the answer of which group I belong to

group 1:0-20 ages
group 2 :21-30 ages
group 3:31-40 ages
group 4: 41-50 ages

thanks


Option Explicit
Sub whichagegroup()
Dim x As Integer
Select Case ActiveCell
Case 0 To 20: x = 1
Case 21 To 30: x = 2
Case 31 To 40: x = 3
Case 41 To 50: x = 4
Case Else
MsgBox "What about us old folks?"
Exit Sub
End Select
MsgBox x
End Sub
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
Match a group of cells with another group of cells Rod in Oz Excel Worksheet Functions 1 October 9th 08 01:45 AM
Help with writing macro Bertha needs help[_2_] Excel Programming 4 August 1st 08 03:23 PM
writing a macro for search-match-copy Marie Excel Programming 3 September 30th 06 03:09 AM
Writing an If Statement for group of cells Larry Excel Programming 2 July 15th 06 04:17 AM
Macro Writing rjamison Excel Programming 0 June 14th 05 12:14 AM


All times are GMT +1. The time now is 11:47 PM.

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

About Us

"It's about Microsoft Excel"