Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I: Cycle through selections by clicking on cell

Ok.....

My boss wants two sections of a worksheet that, when a person clicks on
one cell, the cell directly next to it produces a numerical value that
cycles between 4 numbers as you continue to click on the cell.

Example:
Envision cells A1:12 displaying the months of the year. If you click
on March (A3) one time you get a "1" in cell B3. Click March a second
time you get a "2" in cell B3, etc. (a "Cycle".)

In Cells C1:C12 you have a list of names. Clicking on a name in C6
starts a Cycle in cell D6.

I have the sub-routine that causes the cell to cycle through 4 numbers
by clicking on the cell (see below).

HELP: How do I implement BOTH of subroutines at the same time. This
is what I tried and it produces all sorts of errors:
_______________________________________

Private Sub Worksheet_SelectionChange(ByVal target As Range)
'
If Not Intersect(target, Range("A1:A12")) Is Nothing Then
Call firstselectionsub
'
'
Else
If Not Intersect(target, Range("C1:C12")) Is Nothing Then
Call secondselectionsub
'
End If
End If

End Sub

Sub firstselectionsub()

If target.Count 1 Then
Exit Sub
Else
If target.Offset(0, 1) = "" Then
target.Offset(0, 1).Value = 1
target.Offset(0, -1).Select
'
Else
If target.Offset(0, 1) = "1" Then
target.Offset(0, 1).Value = 2
target.Offset(0, -1).Select
'
Else
If target.Offset(0, 1) = 2 Then
target.Offset(0, 1).Value = 3
target.Offset(0, -1).Select
'
Else
If target.Offset(0, 1) = 3 Then
target.Offset(0, 1).Value = ""
target.Offset(0, -1).Select

End If
End If
End If
End If
End If
End If


End Sub

secondsectionsub
If target.Count 1 Then
Exit Sub
Else
If target.Offset(0, 1) = "" Then
target.Offset(0, 1).Value = 4
target.Offset(0, -1).Select
'
Else
If target.Offset(0, 1) = "4" Then
target.Offset(0, 1).Value = 5
target.Offset(0, -1).Select
'
Else
If target.Offset(0, 1) = 5 Then
target.Offset(0, 1).Value = 6
target.Offset(0, -1).Select
'
Else
If target.Offset(0, 1) = 6 Then
target.Offset(0, 1).Value = ""
target.Offset(0, -1).Select

End If
End If
End If
End If
End If
End If

End sub


---
Message posted from http://www.ExcelForum.com/

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 do I make a graph with 2-cycle X 3-cycle log-log graph paper? Charles A. Wilson Charts and Charting in Excel 1 December 17th 09 03:03 AM
Multiple selections of rows & columns by clicking in one cell FSAnalyst Excel Worksheet Functions 0 November 25th 09 11:09 PM
Why can't I see my cell selections? swalker Excel Discussion (Misc queries) 2 April 24th 09 10:58 PM
Cell Selections MSulaver Excel Discussion (Misc queries) 1 November 19th 08 07:40 PM
How do I keep result from 1 iteration cycle to use in next cycle? sgl8akm Excel Discussion (Misc queries) 0 July 27th 06 08:28 PM


All times are GMT +1. The time now is 07:46 AM.

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"