PC Review


Reply
Thread Tools Rate Thread

Button Problem

 
 
EmmieLou
Guest
Posts: n/a
 
      12th Aug 2008
I have this macro that places a submit button on my worksheet.
It works the first time correctly. Everytime it is used after that it fails
to repeat the first macro, "RawdatatoSummary" and then follows through with
the second macro "Module1.Save". How do I get the Button Macro to repeat the
"RawdatatoSummary" and then "Module1Save" over many times?


ActiveSheet.Buttons.Add(156.75, 36.75, 73.5, 22.5).Select
ActiveSheet.Shapes("Submit").Select
Selection.Characters.Text = "Submit"
With Selection.Characters(Start:=1, Length:=8).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.OnAction = "RawDatatoSummary"
Selection.OnAction = "Module1.Save"

 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      12th Aug 2008
A button can only have one OnAction. you need to acll a main calling
procedure taht calls the two individual macros...

Selection.OnAction = "Module1.DoStuff"

In Module 1 add
sub DoStuff
call RawDatatoSummary
call SaveStuff
end sub

In module 1 change your existing macro frm Save to SaveStuff or something
else as Save is a reserved word in VBA...
--
HTH...

Jim Thomlinson


"EmmieLou" wrote:

> I have this macro that places a submit button on my worksheet.
> It works the first time correctly. Everytime it is used after that it fails
> to repeat the first macro, "RawdatatoSummary" and then follows through with
> the second macro "Module1.Save". How do I get the Button Macro to repeat the
> "RawdatatoSummary" and then "Module1Save" over many times?
>
>
> ActiveSheet.Buttons.Add(156.75, 36.75, 73.5, 22.5).Select
> ActiveSheet.Shapes("Submit").Select
> Selection.Characters.Text = "Submit"
> With Selection.Characters(Start:=1, Length:=8).Font
> .Name = "Arial"
> .FontStyle = "Regular"
> .Size = 10
> .Strikethrough = False
> .Superscript = False
> .Subscript = False
> .OutlineFont = False
> .Shadow = False
> .Underline = xlUnderlineStyleNone
> .ColorIndex = xlAutomatic
> End With
> Selection.OnAction = "RawDatatoSummary"
> Selection.OnAction = "Module1.Save"
>

 
Reply With Quote
 
EmmieLou
Guest
Posts: n/a
 
      12th Aug 2008
Thanks so much. I am still having a little trouble. Is it possible to
combine these two macros? I have functions for each action in SubSaveStuff.
Sub RawDatatoSummary()
Rows("3:3").Select
Selection.Copy
Sheets("Summary").Select
Rows("3:3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Raw Data").Select
Columns("I:I").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Columns("I:I").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Raw Data").Select
Range("A8:H10000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Range("A8").Select
ActiveSheet.Paste
End Sub

AND

Sub SaveStuff()
Dim PedigreeID As Integer
Dim SurveyID As Integer

'Get the corresponding row from the Pedigrees sheet - insert a new
pedigree if necessary
PedigreeID = GetPedigreeRow()

'Get the corresponding row from the Surveys sheet - insert a new survey
if necessary
SurveyID = GetSurveyRow(PedigreeID)

'Insert count information
Call InsertRecords(SurveyID)

Call ClearForm



"EmmieLou" wrote:

> I have this macro that places a submit button on my worksheet.
> It works the first time correctly. Everytime it is used after that it fails
> to repeat the first macro, "RawdatatoSummary" and then follows through with
> the second macro "Module1.Save". How do I get the Button Macro to repeat the
> "RawdatatoSummary" and then "Module1Save" over many times?
>
>
> ActiveSheet.Buttons.Add(156.75, 36.75, 73.5, 22.5).Select
> ActiveSheet.Shapes("Submit").Select
> Selection.Characters.Text = "Submit"
> With Selection.Characters(Start:=1, Length:=8).Font
> .Name = "Arial"
> .FontStyle = "Regular"
> .Size = 10
> .Strikethrough = False
> .Superscript = False
> .Subscript = False
> .OutlineFont = False
> .Shadow = False
> .Underline = xlUnderlineStyleNone
> .ColorIndex = xlAutomatic
> End With
> Selection.OnAction = "RawDatatoSummary"
> Selection.OnAction = "Module1.Save"
>

 
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
Ajax, changing text in a button, and button click problem Tim Microsoft ASP .NET 0 23rd Jul 2008 08:57 PM
Button problem Thor Microsoft Frontpage 2 26th Apr 2008 09:52 PM
Problem with a button in ASP.NET Alejandro Microsoft ASP .NET 0 21st Aug 2006 08:27 PM
Another IE Back Button Problem/Page Loading Problem =?Utf-8?B?UGhvbmc=?= Windows XP Internet Explorer 7 12th Dec 2004 11:57 PM
Button Problem Scott Microsoft Windows 2000 3 10th Feb 2004 04:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:45 PM.