excel-vba

Excel - Return value, after cell has been matched, between headers - V2

拥有回忆 提交于 2020-01-16 10:46:51
问题 This Question is a continuation to the one I posted before at: Excel - Return value, after cell has been matched, between headers As before (and more): • If a number is negative: • Use MATCH to check if there is a correspondent (positive) number in the range (between headers) AND 'IDX' is the same ; • If there is a MATCH output the value of the ID (1st column) of the F that has been matched, and then, output the ID of the negative value that has been matched ; • If not, do nothing. The

Resizing image in word using Excel VBA

左心房为你撑大大i 提交于 2020-01-16 10:02:10
问题 I have this code in excel VBA that creates a word document and paste my screenshot. What I want to do next is to resize the image so i can fit more images in a single page, unfortunately I really don't know what to do next after I paste the image Sub Testing() Dim wrd As Word.Application Set wrd = Word.Application With wrd .Visible = True .Activate .Documents.Add Call PrintScreen .Selection.Paste 'What should i do next? end with End Sub 回答1: You can constrain the size of pictures inserted

Send .Send function (CDO Mail) to background process

那年仲夏 提交于 2020-01-16 09:38:16
问题 The Workbook Hangs until .Send function ends then procedures running have finished. There is a procedure which contains below snip code, calling with another one. .AddAttachment below has about 5MB file passed to. When the VBA code is running, it blocks the main thread, hence the freezing. Some VBA functions (such as printing a Word document) have the option to be sent to a background process. ( .PrintOut Background:=True ) Is it possible to sent .Send function to a background to have the

Can't access Range method of Range object; COM limitations?

非 Y 不嫁゛ 提交于 2020-01-16 09:34:32
问题 In the Excel VBA Editor's Immediate Window, I can do the following: ?ActiveSheet.Range("C3:D4").Range("C3:D4").Address $E$5:$F$6 According to some simple tests, this doesn't seem to respond the same in Matlab. Here is the code to set up the COM interface for the tests: excel = actxserver('Excel.Application'); excel.Visible=1; wbks = excel.Workbooks; wbks.Add sht = wbks.Item(1).Sheets.Item(1) % % Run some range tests % try excel.DisplayAlerts = 0; % Forgo save prompt on Close end; try wbk

Preserve colors from vba when copy sheets to new workbook

天大地大妈咪最大 提交于 2020-01-16 08:56:27
问题 I have a code Sub createPrice() Set ThisWork = ThisWorkbook strExt = ThisWork.Sheets("Main").Cells(1, 4).Value & "_" & Format(Now, "yyyy_mm_dd_hhmmss") strSaveName = ThisWork.Path & "\" & strExt & ".xlsx" ThisWork.Sheets(Array("Main", "Translations")).Copy With ActiveWorkbook .Sheets("Translations").Visible = False .Colors = ThisWork.Colors .SaveAs strSaveName, FileFormat:=51 .Close SaveChanges:=True End With End Sub But Colors in new workbook is differs from original workbook How to preserve

I want to copy all rows from column A on worksheet “Prime Data” and paste into column A on worksheet “Pime - Tracking” with a code

烈酒焚心 提交于 2020-01-16 08:48:13
问题 I have an excel sheet that have a lot of data with various info (i.e...mailing info, best contact person, legal name, phone number, insurance requirements....) New contacts are added all the time and then are filtered in alphabetical order on the "Prime Data" sheet. When I insert a row, on "Prime Data" to add a new contact, the VBA code that I use will copy the data to "Prime - Tracking" sheet and move the cells down to account for the inserted line. The problem is that it only moves the

Dynamic button - Runtime error 1004 - Unable to get the Buttons property of the Worksheet class

混江龙づ霸主 提交于 2020-01-16 08:43:11
问题 Hi I'm getting "Runtime error 1004 - Unable to get the Buttons property of the Worksheet class" and it's coming from line near the bottom Set b = Worksheets("Form").Buttons(Application.Caller) 'references button . I'm basically trying to copy the data in the column next to a dynamic button that appears next to the fully expanded fields of a pivot table. I've got the buttons appearing fine, I just need them to copy the data in the adjacent cell to a list in another sheet when that particular

Auto Sort/Auto Summarize Excel

流过昼夜 提交于 2020-01-16 07:25:09
问题 I tried the following code and I can't seem to get things to work... I am needing help to 1) Auto Sort and then 2) Auto Summarize "like-with-like" based on the following column criteria. . . A few things about this list. . . -I need the item list to sort by alphabetical order -Then I need "like" items and quantities to be summarized. -If there is something I type in the NOTE column I need those quantities to be listed separate (Ex: the item LUS26 in the AFTER picture below) -Also, I need this

How to select distinct values from one column in adodb recordset Excel VBA?

柔情痞子 提交于 2020-01-16 06:58:50
问题 I have a ADODB.Recordset rs that I'm getting from DB. I have to reuse this recordset twice now. This is sample of my Recordset: Mike Client John Manager Karen Client Joe Sub Brian Manager Now I need to get all the titles, so I want to get: Client Manager Sub I know that there is rs.Filter , but I'm not sure if I can select distinct from it. Also I know that I can clone this Recordset: Dim rs_clone As ADODB.Recordset Set rs_clone = New ADODB.Recordset rs_clone = rs.getrows() Is it possible to

How to select distinct values from one column in adodb recordset Excel VBA?

天涯浪子 提交于 2020-01-16 06:58:42
问题 I have a ADODB.Recordset rs that I'm getting from DB. I have to reuse this recordset twice now. This is sample of my Recordset: Mike Client John Manager Karen Client Joe Sub Brian Manager Now I need to get all the titles, so I want to get: Client Manager Sub I know that there is rs.Filter , but I'm not sure if I can select distinct from it. Also I know that I can clone this Recordset: Dim rs_clone As ADODB.Recordset Set rs_clone = New ADODB.Recordset rs_clone = rs.getrows() Is it possible to