PC Review


Reply
Thread Tools Rate Thread

Curious about macro possibility

 
 
WLMPilot
Guest
Posts: n/a
 
      15th Mar 2008
I was wondering, and probably reaching for this one, if a macro can write
another macro and place it in the appropriate "Microsoft Excel Object" sheet?

The project I am working on is a annual scheduling workbook that will create
26 sheets (payperiods) when a commandbutton is clicked and name each sheet
accordingly. During this execution, I was wondering if I could also:

1) create 26 commandbuttons with same caption as its respective sheet, size
and align each button on a sheet,
2) write the three line code for each commandbutton, using the caption (also
name of sheet) as the reference to GOTO that sheet?

Just curious about number 2.

Thanks,
Les
 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      15th Mar 2008
Why not use a template with the controls and code in place? You can read
sheet names, position and change captions and refer to GOTO locations by
reference. I do not see a need to write module code.

--

Regards,
Nigel
(E-Mail Removed)



"WLMPilot" <(E-Mail Removed)> wrote in message
news:34988583-122B-4490-8A09-(E-Mail Removed)...
>I was wondering, and probably reaching for this one, if a macro can write
> another macro and place it in the appropriate "Microsoft Excel Object"
> sheet?
>
> The project I am working on is a annual scheduling workbook that will
> create
> 26 sheets (payperiods) when a commandbutton is clicked and name each sheet
> accordingly. During this execution, I was wondering if I could also:
>
> 1) create 26 commandbuttons with same caption as its respective sheet,
> size
> and align each button on a sheet,
> 2) write the three line code for each commandbutton, using the caption
> (also
> name of sheet) as the reference to GOTO that sheet?
>
> Just curious about number 2.
>
> Thanks,
> Les


 
Reply With Quote
 
Vergel Adriano
Guest
Posts: n/a
 
      15th Mar 2008
I think this will accomplish what you're trying to do. But it uses
hyperlinks instead of buttons..

Sub CreateIndexSheet()
Dim ws As Worksheet
Dim wsIndex As Worksheet
Dim lRow As Long

With ActiveWorkbook
Set wsIndex = .Worksheets.Add(Before:=.Worksheets(1))
wsIndex.Name = "Index"
End With

With wsIndex.Range("A1")
.Value = "Index"
.Font.Bold = True
End With

lRow = 2
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Index" Then
With wsIndex
.Range("A" & lRow).Value = ws.Name
.Hyperlinks.Add Anchor:=.Range("A" & lRow), _
Address:="", _
SubAddress:=ws.Name & "!A1"
lRow = lRow + 1
End With
End If
Next ws
wsIndex.Columns("A").AutoFit
End Sub




--
Hope that helps.

Vergel Adriano


"WLMPilot" wrote:

> I was wondering, and probably reaching for this one, if a macro can write
> another macro and place it in the appropriate "Microsoft Excel Object" sheet?
>
> The project I am working on is a annual scheduling workbook that will create
> 26 sheets (payperiods) when a commandbutton is clicked and name each sheet
> accordingly. During this execution, I was wondering if I could also:
>
> 1) create 26 commandbuttons with same caption as its respective sheet, size
> and align each button on a sheet,
> 2) write the three line code for each commandbutton, using the caption (also
> name of sheet) as the reference to GOTO that sheet?
>
> Just curious about number 2.
>
> Thanks,
> Les

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
coding possibility? scott04 Microsoft Access Forms 2 26th Nov 2007 05:05 PM
Pricelist possibility ? =?Utf-8?B?S2VpdGggRC5CLg==?= Microsoft Excel Misc 3 19th Oct 2006 04:46 PM
Re: Possibility Harvey Van Sickle Freeware 0 24th Nov 2005 10:10 PM
Possibility? Nate Windows XP Performance 1 23rd Nov 2005 06:57 PM
Possibility RaR Spyware Discussion 2 7th Jan 2005 07:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:43 AM.