Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How to create a function to alternate names in a cell from a list?

Im creating a schedule and want to have a button that alternates names from a
list for the selected cell.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default How to create a function to alternate names in a cell from a list?

Here the list of name is in H1 thru H4:

Sub NextName()
Dim r1 As Range, r2 As Range
Set r1 = ActiveCell
Set r2 = Range("H1:H4")

If r1.Value = "" Then
r1.Value = r2(1).Value
Exit Sub
End If

v = r1.Value
For Each rr In r2
If rr.Value = v Then
Set r3 = rr.Offset(1, 0)
If Intersect(r3, r2) Is Nothing Then
Set r3 = r2(1)
End If
r1.Value = r3.Value
End If
Next
End Sub

Change the list to suit your needs.
Assign a button (or any piece of clipart) to the macro.
--
Gary''s Student - gsnu200841


"Elias" wrote:

Im creating a schedule and want to have a button that alternates names from a
list for the selected cell.

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
create a random list of names from a list of names in EXCEL Givvie Excel Worksheet Functions 2 October 23rd 06 05:10 AM
How do I create a list of names and addresses? CJ Excel Discussion (Misc queries) 1 March 13th 06 04:15 AM
How do I create/filter a list of names without duplications MikeD Excel Discussion (Misc queries) 2 October 6th 05 05:25 PM
alternate UI for Define Names ?? jmg092548 Excel Discussion (Misc queries) 2 August 11th 05 01:32 PM
Create a list in one worksheet of the other worksheets' names Kelli Excel Worksheet Functions 0 July 7th 05 08:45 PM


All times are GMT +1. The time now is 08:42 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"