PC Review


Reply
Thread Tools Rate Thread

Change VBA macro

 
 
wietse.uitenbroek@student.hu.nl
Guest
Posts: n/a
 
      30th Mar 2007
Hi all,

I hope someone could help me with the following. I want to change the
VBA code below in such a way that there is only one msgbox. After the
question in this new (one and only) msgbox (question something like:
Do you want to insert the files?) all files should be put in. Does
someone know how to do so and what the code should look like?

Thanks in advance,

Wietse

VBA code:


If MsgBox("insert " & Range("rates").Value2 & " ?", vbYesNo) = vbYes
Then Run "Insertrates"
If MsgBox("insert " & Range("Deals").Value2 & " ?", vbYesNo) = vbYes
Then Run "InsertDeals"
If MsgBox("insert " & Range("Deals2").Value2 & " ?", vbYesNo) = vbYes
Then Run "InsertDeals2"
If MsgBox("insert " & Range("DealsPrev").Value2 & " ?", vbYesNo) =
vbYes Then Run "InsertDealsPrev"
If MsgBox("insert " & Range("Deals2Prev").Value2 & " ?", vbYesNo) =
vbYes Then Run "InsertDeals2Prev"
If MsgBox("insert " & Range("Deals2After").Value2 & " ?", vbYesNo) =
vbYes Then Run "InsertDeals2After"
If MsgBox("insert " & Range("rates Today").Value2 & " ?", vbYesNo) =
vbYes Then Run "InsertratesToday"
If MsgBox("insert " & Range("rates Yest").Value2 & " ?", vbYesNo) =
vbYes Then Run "InsertratesYest"
If MsgBox("insert " & Range("Sum").Value2 & " ?", vbYesNo) = vbYes
Then Run "InsertSum"
If MsgBox("insert " & Range("SumYest").Value2 & " ?", vbYesNo) = vbYes
Then Run "InsertSumYest"

 
Reply With Quote
 
 
 
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      30th Mar 2007
Hi

If MsgBox("Do you want to insert files?", vbYesNo) = vbYes Then
Run "Insertrates"
Run "InsertDeals"
Run "InsertDeals2"
Run "InsertDealsPrev"
Run "InsertDeals2Prev"
Run "InsertDeals2After"
Run "InsertratesToday"
Run "InsertratesYest"
Run "InsertSum"
Run "InsertSumYest"
End if

regards
Paul


On Mar 30, 9:37 am, wietse.uitenbr...@student.hu.nl wrote:
> Hi all,
>
> I hope someone could help me with the following. I want to change the
> VBA code below in such a way that there is only one msgbox. After the
> question in this new (one and only) msgbox (question something like:
> Do you want to insert the files?) all files should be put in. Does
> someone know how to do so and what the code should look like?
>
> Thanks in advance,
>
> Wietse
>
> VBA code:
>
> If MsgBox("insert " & Range("rates").Value2 & " ?", vbYesNo) = vbYes
> Then Run "Insertrates"
> If MsgBox("insert " & Range("Deals").Value2 & " ?", vbYesNo) = vbYes
> Then Run "InsertDeals"
> If MsgBox("insert " & Range("Deals2").Value2 & " ?", vbYesNo) = vbYes
> Then Run "InsertDeals2"
> If MsgBox("insert " & Range("DealsPrev").Value2 & " ?", vbYesNo) =
> vbYes Then Run "InsertDealsPrev"
> If MsgBox("insert " & Range("Deals2Prev").Value2 & " ?", vbYesNo) =
> vbYes Then Run "InsertDeals2Prev"
> If MsgBox("insert " & Range("Deals2After").Value2 & " ?", vbYesNo) =
> vbYes Then Run "InsertDeals2After"
> If MsgBox("insert " & Range("rates Today").Value2 & " ?", vbYesNo) =
> vbYes Then Run "InsertratesToday"
> If MsgBox("insert " & Range("rates Yest").Value2 & " ?", vbYesNo) =
> vbYes Then Run "InsertratesYest"
> If MsgBox("insert " & Range("Sum").Value2 & " ?", vbYesNo) = vbYes
> Then Run "InsertSum"
> If MsgBox("insert " & Range("SumYest").Value2 & " ?", vbYesNo) = vbYes
> Then Run "InsertSumYest"



 
Reply With Quote
 
wietse.uitenbroek@student.hu.nl
Guest
Posts: n/a
 
      30th Mar 2007
One more question, how can I make sure that when the question "Do you
want to insert files?" is answered with No that then all single
msgboxes will start to ask if you want to insert the single files?

On Mar 30, 10:42 am, paul.robin...@it-tallaght.ie wrote:
> Hi
>
> If MsgBox("Do you want to insert files?", vbYesNo) = vbYes Then
> Run "Insertrates"
> Run "InsertDeals"
> Run "InsertDeals2"
> Run "InsertDealsPrev"
> Run "InsertDeals2Prev"
> Run "InsertDeals2After"
> Run "InsertratesToday"
> Run "InsertratesYest"
> Run "InsertSum"
> Run "InsertSumYest"
> End if
>
> regards
> Paul
>
> On Mar 30, 9:37 am, wietse.uitenbr...@student.hu.nl wrote:
>
>
>
> > Hi all,

>
> > I hope someone could help me with the following. I want to change the
> > VBA code below in such a way that there is only one msgbox. After the
> > question in this new (one and only) msgbox (question something like:
> > Do you want to insert the files?) all files should be put in. Does
> > someone know how to do so and what the code should look like?

>
> > Thanks in advance,

>
> > Wietse

>
> > VBA code:

>
> > If MsgBox("insert " & Range("rates").Value2 & " ?", vbYesNo) = vbYes
> > Then Run "Insertrates"
> > If MsgBox("insert " & Range("Deals").Value2 & " ?", vbYesNo) = vbYes
> > Then Run "InsertDeals"
> > If MsgBox("insert " & Range("Deals2").Value2 & " ?", vbYesNo) = vbYes
> > Then Run "InsertDeals2"
> > If MsgBox("insert " & Range("DealsPrev").Value2 & " ?", vbYesNo) =
> > vbYes Then Run "InsertDealsPrev"
> > If MsgBox("insert " & Range("Deals2Prev").Value2 & " ?", vbYesNo) =
> > vbYes Then Run "InsertDeals2Prev"
> > If MsgBox("insert " & Range("Deals2After").Value2 & " ?", vbYesNo) =
> > vbYes Then Run "InsertDeals2After"
> > If MsgBox("insert " & Range("rates Today").Value2 & " ?", vbYesNo) =
> > vbYes Then Run "InsertratesToday"
> > If MsgBox("insert " & Range("rates Yest").Value2 & " ?", vbYesNo) =
> > vbYes Then Run "InsertratesYest"
> > If MsgBox("insert " & Range("Sum").Value2 & " ?", vbYesNo) = vbYes
> > Then Run "InsertSum"
> > If MsgBox("insert " & Range("SumYest").Value2 & " ?", vbYesNo) = vbYes
> > Then Run "InsertSumYest"- Hide quoted text -

>
> - Show quoted text -



 
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
Use Macro To Change Which Macro Assigned To Command Button CVinje Microsoft Excel Misc 0 25th May 2010 09:55 PM
macro that will change the font of a cell if i change a value jk Microsoft Excel Misc 2 29th Jul 2008 04:39 PM
Macro to change macro or module level const that is calculated Ren Microsoft Excel Programming 1 28th Nov 2007 10:23 PM
Cell value change to trigger macro (worksheet change event?) =?Utf-8?B?TmVpbCBHb2xkd2Fzc2Vy?= Microsoft Excel Programming 4 10th Jan 2006 01:55 PM
Prevent Macro to run Macro on Worksheet.Change =?Utf-8?B?YWt5aG5l?= Microsoft Excel Worksheet Functions 3 21st Sep 2004 11:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:15 AM.