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 can you make an array of objects?

I am try to make a user form where people can enter thier work schedul
(what days they work).

The format I am trying to reproduce looks like 'this
(http://www.timeanddate.com/calendar/).

The way I have it setup there is a spin button which determines whic
is the current month and then I have 35 labels and textboxes setup in
matrix similart to this:

1 2 3 4 5 6 7
[] [] [] [] [] [] []

8 9 10 11 12 13 14
[] [] [] [] [] [] []

15 16 17 18 19 20 21
[] [] [] [] [] [] []

22 23 24 25 26 27 28
[] [] [] [] [] [] []

29 30 31 32 33 34 35
[] [] [] [] [] [] []

What I want to do is, adjust this for the current month.

For instance, if the current month was September of 2004 then I woul
hide labels and textboxes 1, 2, 3, as well as 34 and 35 by changin
thier 'visible' property to false. I would then rename the remainin
labels/textboxes to reflect the appropriate dates.

The only sane way I can think of doing this is by putting all th
elements in an array and then hide and rename things in a for loo
where appropriate.

Thanks ahead of time

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How can you make an array of objects?

Here's a little routine that does it. Just pass the year and month to it,
e.g. SetupCalendar 2004,9

Sub setupcalendar(yr As Long, mnth As Long)
Dim nWeekday As Long
Dim nDay As Long
Dim i As Long

nWeekday = Weekday(DateSerial(yr, mnth, 1))
nDay = Day(DateSerial(yr, mnth + 1, 0))
For i = 1 To nWeekday - 1
Me.Controls("TextBox" & i).Visible = False
Next i

For i = nWeekday To nDay + nWeekday - 1
Me.Controls("TextBox" & i).Visible = True
Me.Controls("TextBox" & i).Text = i - nWeekday + 1
Next i

For i = nWeekday + nDay To 35
Me.Controls("TextBox" & i).Visible = False
Next i

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ynotravid " wrote in message
...
I am try to make a user form where people can enter thier work schedule
(what days they work).

The format I am trying to reproduce looks like 'this'
(http://www.timeanddate.com/calendar/).

The way I have it setup there is a spin button which determines which
is the current month and then I have 35 labels and textboxes setup in a
matrix similart to this:

1 2 3 4 5 6 7
[] [] [] [] [] [] []

8 9 10 11 12 13 14
[] [] [] [] [] [] []

15 16 17 18 19 20 21
[] [] [] [] [] [] []

22 23 24 25 26 27 28
[] [] [] [] [] [] []

29 30 31 32 33 34 35
[] [] [] [] [] [] []

What I want to do is, adjust this for the current month.

For instance, if the current month was September of 2004 then I would
hide labels and textboxes 1, 2, 3, as well as 34 and 35 by changing
thier 'visible' property to false. I would then rename the remaining
labels/textboxes to reflect the appropriate dates.

The only sane way I can think of doing this is by putting all the
elements in an array and then hide and rename things in a for loop
where appropriate.

Thanks ahead of time.


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default How can you make an array of objects?

I think you will need 42 days. look at October 2004.
-----Original Message-----
I am try to make a user form where people can enter thier

work schedule
(what days they work).

The format I am trying to reproduce looks like 'this'
(http://www.timeanddate.com/calendar/).

The way I have it setup there is a spin button which

determines which
is the current month and then I have 35 labels and

textboxes setup in a
matrix similart to this:

1 2 3 4 5 6 7
[] [] [] [] [] [] []

8 9 10 11 12 13 14
[] [] [] [] [] [] []

15 16 17 18 19 20 21
[] [] [] [] [] [] []

22 23 24 25 26 27 28
[] [] [] [] [] [] []

29 30 31 32 33 34 35
[] [] [] [] [] [] []

What I want to do is, adjust this for the current month.

For instance, if the current month was September of 2004

then I would
hide labels and textboxes 1, 2, 3, as well as 34 and 35

by changing
thier 'visible' property to false. I would then rename

the remaining
labels/textboxes to reflect the appropriate dates.

The only sane way I can think of doing this is by putting

all the
elements in an array and then hide and rename things in a

for loop
where appropriate.

Thanks ahead of time.


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

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How can you make an array of objects?

only (sic!) 37.

This gives an inherent problem, you will have a big gap at the bottom when
you have Feb starting on Sunday.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Stone" wrote in message
...
I think you will need 42 days. look at October 2004.
-----Original Message-----
I am try to make a user form where people can enter thier

work schedule
(what days they work).

The format I am trying to reproduce looks like 'this'
(http://www.timeanddate.com/calendar/).

The way I have it setup there is a spin button which

determines which
is the current month and then I have 35 labels and

textboxes setup in a
matrix similart to this:

1 2 3 4 5 6 7
[] [] [] [] [] [] []

8 9 10 11 12 13 14
[] [] [] [] [] [] []

15 16 17 18 19 20 21
[] [] [] [] [] [] []

22 23 24 25 26 27 28
[] [] [] [] [] [] []

29 30 31 32 33 34 35
[] [] [] [] [] [] []

What I want to do is, adjust this for the current month.

For instance, if the current month was September of 2004

then I would
hide labels and textboxes 1, 2, 3, as well as 34 and 35

by changing
thier 'visible' property to false. I would then rename

the remaining
labels/textboxes to reflect the appropriate dates.

The only sane way I can think of doing this is by putting

all the
elements in an array and then hide and rename things in a

for loop
where appropriate.

Thanks ahead of time.


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

.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can you make an array of objects?

thanks guys, you are awsome, I'm going to try it right now

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can you make an array of objects?

um stupid question... is 'Me' analogous to 'this' in C++ where it refer
to the current objects name space

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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How can you make an array of objects?

Don't know C++, but from your description doesn't sound quite the same. In
VBA, Me refers to the instance of the current executing class. So, in a form
it refers to the userform class, in a worksheet, that worksheet class.

It is useful to pass the instance to a generic routine as a parameter In
this instance it is nor absolutely necessary, I just tend to always qualify
with Me.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ynotravid " wrote in message
...
um stupid question... is 'Me' analogous to 'this' in C++ where it refers
to the current objects name space?


---
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
Make formula more simple --- array? Nikki Excel Discussion (Misc queries) 6 April 11th 07 07:21 PM
Can I make array position A(12) into a variable A(12*n) ? Paul Excel Worksheet Functions 1 October 9th 06 10:37 PM
How do I make excel hide columns when it says cannot move objects Dale Excel Discussion (Misc queries) 0 November 10th 05 02:44 PM
The # in my vector is absent from my array. Can I make it 0? Matherley Excel Worksheet Functions 1 July 14th 05 08:52 PM
Using a variabel to make an array? SkatKat Excel Programming 4 May 24th 04 02:08 PM


All times are GMT +1. The time now is 05:48 PM.

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"