excel-vba

Duplication error in current scope VBA Code

一笑奈何 提交于 2020-01-25 20:46:05
问题 Function Heston(Actualvol, m, theta, col, nSim) As Double Dim Actualvol As Double,FinalVol As DOuble, VT As Double, i As Integer, theta As Double, col As Double, m As Double, nSim As Long dt = 1 / 252 For i = 1 To nSim VT = Actualvol + m * (theta - Actualvol) * dt + col * Sqr(Actualvol) * Application.NormInv(Rnd(), 0, 1) * Sqr(dt) Sum = Sum + VT Next FinalVol = Sqr(VT) Heston = FinalVol End Function Please check why compiler says "Duplicate error outside the current scope" ? 来源: https:/

ActiveX can't create object powerpont vba

99封情书 提交于 2020-01-25 20:28:12
问题 I am trying to copy 1st slide from the powerpoint and insert it at the end but I am getting ActiveX can't create object on the line ActivePresentation.Slides(1).Copy This is my full code and I've added the reference to microsoft powerpoint library as well Option Explicit Dim myFile, Fileselected As String, Path As String, objPPT As Object Dim activeSlide As PowerPoint.Slide Sub Generate_PPTs() Application.ScreenUpdating = False Set myFile = Application.FileDialog(msoFileDialogOpen) With

ActiveX can't create object powerpont vba

早过忘川 提交于 2020-01-25 20:27:25
问题 I am trying to copy 1st slide from the powerpoint and insert it at the end but I am getting ActiveX can't create object on the line ActivePresentation.Slides(1).Copy This is my full code and I've added the reference to microsoft powerpoint library as well Option Explicit Dim myFile, Fileselected As String, Path As String, objPPT As Object Dim activeSlide As PowerPoint.Slide Sub Generate_PPTs() Application.ScreenUpdating = False Set myFile = Application.FileDialog(msoFileDialogOpen) With

VBA Search for files with names containing string within folders and subfolders

寵の児 提交于 2020-01-25 20:24:28
问题 I am trying to write some code to search through a set of 600 folders (300 of which are empty) and all of their subfolders for filenames containing a string SearchTerm from a list of 6 such as " catchment table .xls", " catchment table .doc" The names of any files found containing SearchTerm such as "Manchester Catchment Table 3.xlsx" Should be be input into list on sheet in a new workbook named after the Parent folder. So I end up with a workbook with 300 tabs each with a Parent folder title

Autofill a column with month name depending on the date in another column - Excel VBA

我怕爱的太早我们不能终老 提交于 2020-01-25 20:00:15
问题 I'm new in working with Excel VBA and I have this problem. I would like my userform to autofill dynamic range in a column based on the date picked by the user. When the "create" button is clicked, simultaneously, on one column of the sheet the date is populated and on another column beside it, the Month name is also populated depending on the date encoded. Do you think it'll be possible? Your efforts will be greatly appreciated. Thanks! Private Sub CommandButton1_Click() If Week <> "" Then

How to Parsing Full String and split into several String in Excel VBA?

三世轮回 提交于 2020-01-25 19:22:57
问题 I need help in Excel VBA. I have situation that i need to split into several data from a String. There is now specific delimiter, the condition is only a Keyword. The example of the Full String Data i got is like this: /*ORDER FORM*/ Name: Randy Full Address: Unknown Street 123 ABC Phone:0246854612 Order: 1x G Action Figure 1x Y Action Figure 2x Z Action Figure /*Fill Bank and Amount of Transfer*/ Bank: ABC Total: 2000 /*If you Reseller, Fill Data below*/ Sender: SenderPhone: /*Thank you for

How to Parsing Full String and split into several String in Excel VBA?

我只是一个虾纸丫 提交于 2020-01-25 19:21:07
问题 I need help in Excel VBA. I have situation that i need to split into several data from a String. There is now specific delimiter, the condition is only a Keyword. The example of the Full String Data i got is like this: /*ORDER FORM*/ Name: Randy Full Address: Unknown Street 123 ABC Phone:0246854612 Order: 1x G Action Figure 1x Y Action Figure 2x Z Action Figure /*Fill Bank and Amount of Transfer*/ Bank: ABC Total: 2000 /*If you Reseller, Fill Data below*/ Sender: SenderPhone: /*Thank you for

How to set a VPageBreak between two specific columns?

冷暖自知 提交于 2020-01-25 19:03:10
问题 I programmed a little tool in VBA which generates a sheet with some statistics on it. I want to automatically have a printable worksheet, so I set the VPageBreak like this: ActiveWindow.View = xlPageBreakPreview ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1 ActiveWindow.View = xlNormalView At first this worked just fine. But the content of this generated worksheet is based on data in another worksheet and when this data changed, the DragOff-Command threw an error.

Convert 2 dimensional array to one dimensional (without Looping)

佐手、 提交于 2020-01-25 17:46:49
问题 I found this worked well for an Excel Range, where the result would be array(n) notation instead of array(1, n) Result = Application.Transpose(Application.Transpose(Worksheets(kSheet).Range("Y20:AC20"))) However I have a result from .getrows which is array (n,0) notation. Can this be converted to arry(n) notation similar to above ? 回答1: You have discovered an anomaly (bug?) and, with a very limited explanation of that anomaly, ask how to extend its availability. That is why no one can