PC Review


Reply
Thread Tools Rate Thread

Activate a moacro subroutine from a userform command button

 
 
Roger on Excel
Guest
Posts: n/a
 
      27th Nov 2009
[Excel 2003]

I use macros in a worksheet - for example:

Sub DateStamp()
Range("b14") = Date & " " & Time 'Date And Time
End Sub

I access the macro with a command button in the spreadsheet.

I would now like to access the same code using a command button on a Userform.

I guess I could repeat the same code in the command button on the userform,
but I would rather not duplicate the code.

Is there a way to do this?

Many thanks,

Roger
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      27th Nov 2009
Hi,

Private Sub CommandButton1_Click()
Call DateStamp
End Sub

Mike

"Roger on Excel" wrote:

> [Excel 2003]
>
> I use macros in a worksheet - for example:
>
> Sub DateStamp()
> Range("b14") = Date & " " & Time 'Date And Time
> End Sub
>
> I access the macro with a command button in the spreadsheet.
>
> I would now like to access the same code using a command button on a Userform.
>
> I guess I could repeat the same code in the command button on the userform,
> but I would rather not duplicate the code.
>
> Is there a way to do this?
>
> Many thanks,
>
> Roger

 
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
print command from command button in userform causes double chart Mike Jamesson Microsoft Excel Programming 5 11th Aug 2009 03:42 AM
BUG: print command from command button in userform causes double c Mike Jamesson Microsoft Excel Programming 0 10th Aug 2009 04:19 PM
Calling a subroutine with a command button JonV Microsoft Excel Programming 2 7th Jul 2008 10:45 PM
button to activate userform Virginia Microsoft Excel Programming 2 15th Aug 2004 10:27 PM
Button On Userform To Activate Woorksheet Mathew Microsoft Excel Misc 3 25th Mar 2004 07:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:37 PM.