Change VBA macro

  • Thread starter Thread starter wietse.uitenbroek
  • Start date Start date
W

wietse.uitenbroek

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"
 
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
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top