Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default A Sub in another Sub...

Hi,

I have a rather basic question: I have made two macros in vb that works out
just fine one by one. Now I need to include one macro into another. I need
the macro called Sub EnterMonthYear to be included at the very end of the Sub
Table

I'm sure there's a simple code to trigger the Sub EnterMonthYear, but I
can't seem to find an answer anywhere..


The programming is like this:

Sub Table ()
..
..
*
End Sub

Sub EnterMonthYear
Dim MyMonth as String
Sheets("Inputsheet").Range("x6").Value=InputBox("E nter month")
Dim MyYear as String
Sheets("Inputsheet").Range("Y6").Value=InputBox("E nter year")
End Sub

Thankful for a response!

Traima
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default A Sub in another Sub...

Use the Call Statement which transfers control to a Sub procedure, Function
procedure, or DLL procedure..

Call EnterMonthYear

--
Jacob (MVP - Excel)


"Traima" wrote:

Hi,

I have a rather basic question: I have made two macros in vb that works out
just fine one by one. Now I need to include one macro into another. I need
the macro called Sub EnterMonthYear to be included at the very end of the Sub
Table

I'm sure there's a simple code to trigger the Sub EnterMonthYear, but I
can't seem to find an answer anywhere..


The programming is like this:

Sub Table ()
.
.
*
End Sub

Sub EnterMonthYear
Dim MyMonth as String
Sheets("Inputsheet").Range("x6").Value=InputBox("E nter month")
Dim MyYear as String
Sheets("Inputsheet").Range("Y6").Value=InputBox("E nter year")
End Sub

Thankful for a response!

Traima

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default A Sub in another Sub...

Sub Table ()
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default A Sub in another Sub...

Thanks, both of you.

This immediately solved my problem!

Traima

"steve" wrote:

Sub Table ()
.
.
* Call EnterMonthYear *
End Sub


"Traima" wrote in message
...
Hi,

I have a rather basic question: I have made two macros in vb that works
out
just fine one by one. Now I need to include one macro into another. I
need
the macro called Sub EnterMonthYear to be included at the very end of the
Sub
Table

I'm sure there's a simple code to trigger the Sub EnterMonthYear, but I
can't seem to find an answer anywhere..


The programming is like this:

Sub Table ()
.
.
*
End Sub

Sub EnterMonthYear
Dim MyMonth as String
Sheets("Inputsheet").Range("x6").Value=InputBox("E nter month")
Dim MyYear as String
Sheets("Inputsheet").Range("Y6").Value=InputBox("E nter year")
End Sub

Thankful for a response!

Traima



.

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



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