ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   I'd like to create a list box containing "jumps" to other cells... (https://www.excelbanter.com/excel-discussion-misc-queries/17697-id-like-create-list-box-containing-%22jumps%22-other-cells.html)

Birmangirl

I'd like to create a list box containing "jumps" to other cells...
 
....I have a simple calendar spreadsheet in Excel 2002 (12 months on one
sheet, arranged vertically). I'd like to add a list box in A1 that contains
months - when you choose one, the cursor jumps to the beginning of that
month? I'm sure this is possible - the best way please?

Thanks in advance
Amanda

Dave Peterson

Maybe you could set up a list of month names on another sheet.

Then use Data|validation in A1--and use that list as the source.
See Debra Dalgleish's site to see how to point to a range on another sheet:
http://www.contextures.com/xlDataVal01.html#Create

Then create names for 12 cells on that calendar sheet.
(January, February, ..., December)
Deb's site, again:
http://www.contextures.com/xlNames01.html#NameBox

Then rightclick on the worksheet tab that has the calendar and select view
code. Paste this in:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a1")) Is Nothing Then Exit Sub

On Error Resume Next
Application.Goto Target.Value, scroll:=True
If Err.Number < 0 Then
MsgBox "Design error!!!"
Err.Clear
End If
On Error GoTo 0

End Sub

(If you use this with xl97, it won't work--it was a bug that was fixed in xl2k.)



Birmangirl wrote:

...I have a simple calendar spreadsheet in Excel 2002 (12 months on one
sheet, arranged vertically). I'd like to add a list box in A1 that contains
months - when you choose one, the cursor jumps to the beginning of that
month? I'm sure this is possible - the best way please?

Thanks in advance
Amanda


--

Dave Peterson


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com