excel-vba

Edit formulas of multiple workbooks to remove external references / change the reference to the local workbook

不想你离开。 提交于 2020-01-15 10:44:05
问题 I have copied a worksheet into a batch of workbooks (around 45). This worksheet contains formulas and references i.e. =Sheetname!A1 and =IF(Sheetname!A2=1, "this", "that"). However when the sheet has been copied, these formulas have become =[Original_Book.xlsm]Sheetname!$A$1 and =IF([Original_Book.xlsm]Sheetname!A2=1, "this", "that"). I'd like a way to remove all of the "[Original_Book.xlsm]" references so that the formulas become local again. Actual examples (the above being for illustrative

VBA xlPasteValues fails on 2nd run

[亡魂溺海] 提交于 2020-01-15 10:19:46
问题 I have a short code that basically copies a selected row to another sheet, and deletes it from the first. For some reason when I run this, it will run just fine, if I then select a different row, I get a pasteSpecial method of RangeClass failed error. Sub Completed() Dim trackerRow As Integer, compRow As Integer, answer As Integer Application.ScreenUpdating = False Application.CutCopyMode = False trackerRow = ActiveCell.Row compRow = Sheets("Completed").Cells(Rows.Count, "B").End(xlUp).Row If

Copy email subject in outlook to excel using vba with two email address?

社会主义新天地 提交于 2020-01-15 09:47:14
问题 I have two email address. The first is address1@domain.com.vn and the second is address2@domain.com.vn . I want to copy email subject in microsoft outlook with second address address2@domain.com.vn to excel using vba. I use bellow code but it do not work. Sub GetFromInbox() Dim olapp As Outlook.Application Dim olNs As Namespace Dim Fldr As MAPIFolder Dim olMail As Variant Dim Pst_Folder_Name Dim MailboxName 'Dim date1 As Date Dim i As Integer Sheets("sheet1").Visible = True Sheets("sheet1")

Excel VBA: how to solve Index and Match function type mismatch error

冷暖自知 提交于 2020-01-15 09:32:13
问题 I encounter error in index and match functions when the counter of date changes. I wrote a comment when I face with error. I uploaded a sample of my data if it needed. sample : http://s000.tinyupload.com/?file_id=00243748825638974221 here is the code : Sub regionalAverage() Application.ScreenUpdating = False Application.DisplayStatusBar = False Application.EnableEvents = False ActiveSheet.DisplayPageBreaks = False ' *** change the declaration here *** Dim aname() As String Dim rw As Variant

Excel VBA - Change button visibility based on update to adjacent cell

∥☆過路亽.° 提交于 2020-01-15 09:31:48
问题 I have data in column "AK" and a button in Column "AL"; there are several hundred rows and there is only one macro for all buttons as it uses relative references based on the row it is in. I want the button to only be visible when there is data in the adjacent cell. The following pseudo-code explains what I am trying to achieve: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 37 Then If Target.Value = 0 Then Shapes(Target.offset(0, 1)).Visible = False Else Shapes(Target

VBA xlBarClustered how do you distinguish between the two different presets?

*爱你&永不变心* 提交于 2020-01-15 09:26:36
问题 I have a chart template saved using the xlBarclustered chart type. I want it to be based upon the left default chart (see image below) but it chooses right. I have another document with a copy of the same code that chooses right. Is it possible to distinguish? When using record macro it has the same code for both left and right charts which is copied below. Thanks Set cht = WS_FS.Shapes.AddChart2(216, xlBarClustered, Left:=WS_FS.Cells(row, 5).Left, Top:=WS_FS.Cells(row, 5).Top, Width:=425,

VBA xlBarClustered how do you distinguish between the two different presets?

早过忘川 提交于 2020-01-15 09:25:09
问题 I have a chart template saved using the xlBarclustered chart type. I want it to be based upon the left default chart (see image below) but it chooses right. I have another document with a copy of the same code that chooses right. Is it possible to distinguish? When using record macro it has the same code for both left and right charts which is copied below. Thanks Set cht = WS_FS.Shapes.AddChart2(216, xlBarClustered, Left:=WS_FS.Cells(row, 5).Left, Top:=WS_FS.Cells(row, 5).Top, Width:=425,

VBA-Insert body of email above signature using Lotus Notes

此生再无相见时 提交于 2020-01-15 09:19:13
问题 What I am trying to achieve is very simple, insert the body of an email above the signature in lotus notes. The code I have in vba, when run, opens a new email window in lotus notes pastes in the Subject, SendTo and Body fields. Everything works perfectly, but when the body is inserted it puts the text below my signature. I've done a ton of digging to try and find a solution, but haven't found anything that has worked just right. A few posts I've found suggest removing the signature, pasting

Set an excel chart filter with VBA

女生的网名这么多〃 提交于 2020-01-15 09:19:10
问题 I have a sheet with lots of standard Excel charts (Not Pivot charts!). I add data every week and want the charts to show data for the last 4 weeks. Because I have a lot of charts I want to automatically select the filtered weeks with a macro. Dynamic ranges are not feasible, as there are too many charts with 5 data series each. When I record a macro and activate the filter for a certain week, I get the following code: ActiveChart.ChartGroups(1).FullCategoryCollection(76).IsFiltered = True The

Unable to perform a click on a certain link

只愿长相守 提交于 2020-01-15 08:45:32
问题 I've written some code in vba using IE to reach a certain webpage. To get that webpage it is necessary to initiate a click on a link in the opening page and when the click is successfully performed then the page i am after shows up. However, I can't find any way to click on that very link. Elements for the link within: <div id="grid" data-role="grid" class="k-grid k-widget" style="opacity: 1;"><div class="k-grid-header" style="padding-right: 17px;"><div class="k-grid-header-wrap k-auto