Visual Basic for Applications; a subset of Visual Basic used in all Microsoft Office applications. Consider using this tag together with the tag for the specific application in question.

learn more… | top users | synonyms

0
votes
0answers
19 views

How can I default the 'from' e-mail address when replying to e-mail in shared mailbox?

I am connected to a shared mailbox and do not have Exchange authorization to send as that address so I would like to reply to all e-mails in that mailbox using my default Exchange account. Is there a ...
2
votes
0answers
31 views

How to enable macros on an external hard-drive

I have an external hard-drive that I have mapped locally to the e:\ drive. There is a subfolder that contains Excel sheets with macros that I am unable to run. In File->Options->Trust ...
1
vote
2answers
70 views

Counting specific words within a batch of Word documents

I need a count of the number of times an acronym (e.g. ‘ABC’) is used in a collection of word documents. The acronym is always three letters and in block caps. All the word documents are contained ...
0
votes
0answers
38 views

Optimize VBA code(efficient code) and ensure distributability

To perform the following actions: Copy a particular "template"-worksheets as many times as the number of cells selected in the master database Create worksheets (with names) based on the selected ...
0
votes
1answer
9 views

Identifying WHICH textbox is being executed

I have a worksheet that has dozens of text boxes. A number of them execute the same macro while a number of others execute another macro, etc. I have five groups of text boxes executing five ...
-1
votes
1answer
37 views

How can I print only pages I have selected by a checkbox to print in MS Word?

I have a protected Word document with many macros. It is approximately 45 pages long. I want to add a checkbox on the top of each page and run a macro so that only the checked pages will be printed. ...
0
votes
0answers
25 views

Macro Hyperlink Error in Mac OS (Office for Mac 2011)

I am getting an error on a macro only when using a Mac. This macro was designed to solve a problem with a formula using the Hyperlink function to copy a link from another sheet for each row. (Excel ...
0
votes
1answer
183 views

Creating folders and subfolders from Excel cell values

I'm trying to create a directory named as the value in column E within a directory (c:/Site Information), then create a further directory called the concatenated value of column A, B, C, and D. This ...
0
votes
1answer
44 views

Running macro on multiple sheets

I can run macro on individual worksheets but not all open worksheets. I want to run this macro on 700 worksheets. We are trying to delete one column. Sub RunMacroOnAllSheetsToRight() For i = ...
1
vote
1answer
90 views

Macro to Copy Hyperlink from Another Sheet [closed]

I have a Macro that I found on this site to copy hyperlinks inserted through the ribbon to a different column in another sheet. However, the macro is only working on the first row. I added Do until ...
0
votes
2answers
88 views

Needs VBA solution - Clear contents of 4 cells to left of cell with N/A Error

I have a table of data in which column L has a vlookup formula. In the rows where column L (i.e., the vlookup returns "#N/A"), I would like to clear the contents of the eight cells to the left ...
2
votes
1answer
87 views

How to convert formatted text in a Powerpoint table cell to HTML

I want to convert a table in a Powerpoint slide to HTML. I know how to put in the table tags, but cannot work out how to convert formatted text inside the table cells to HTML. So, for example, how can ...
2
votes
0answers
105 views

Append values to Access table from Excel with ID autogenerated

I have an Access database with some tables which get updated daily with some values. I need the tables to have an ID field which is auto-generated when the other values of the table are imported from ...
0
votes
0answers
29 views

How to export images from Excel table [duplicate]

I have an Excel table with two columns: id and picture. id is a string and picture contains a single jpeg picture. This table contains almost 1,000 rows. Is it possible to export the images as jpeg ...
0
votes
0answers
51 views

Excel, macro move one row down and then delete the row

I'm trying to clean up duplicate rows. My data is in a table with filters applied. I have tried using the Excel feature to remove duplicates, but get the following error. Cannot complete ...
2
votes
0answers
18 views

How to return results of SQL query to Excel sheet with VBA function [duplicate]

I'm trying to create a VBA function in Excel to affect dynamic value from Access to Excel sheet. This is my code. Public Function SQL(DB As String, Query As String) Dim conn As ADODB.Connection ...
-2
votes
1answer
30 views

How can I find cell with minimum value in a column and add the values next to it to another range?

I have values in range A1:A3 and also in B1:D3.I would like to find the cell with minimum value in range A1:A3 and to add the all row values next to that cell to another range by hitting a command ...
1
vote
1answer
76 views

How can I replace forbidden characters in a file names before saving in VBA?

This will be very simple for somebody who knows VBA better than me. I used a code original provided by user Nixda on this forum to split excel worksheet into multiple CSV files based on column value ...
0
votes
1answer
40 views

Web Scraping Macro error

I am trying to scrap multiple pages that are a search result of a key work. I wrote this code but I am getting an error when I run it. Error: Application \-defined or object-defined error. When I ...
0
votes
2answers
83 views

How to give worksheet tab a color if range of cells contains text

I have tried code that I've found on SE, and elsewhere but they aren't working as I think they can. I'll list them below. I'm almost certain this is an easy question. What I'm trying to do: If in any ...
0
votes
1answer
18 views

Converting a column list from A2:A142 to a list with commas into cell B1; holding a format as “0000” with leading zeros

This code works to convert the column list to a concatenated list with commas, however the format doesn't have leading zeros while the VBA loops in B!. Dim i As Integer Dim s As String i = 2 Do ...
1
vote
1answer
39 views

How to paste static value, not dynamic value in VBA

How do I change this piece of VBA code such that instead of =datewanted in the excel cell, I get the static value of the "datewanted". ws.Range("A" & lastRowofA & ":A" & lastRow).Formula ...
0
votes
1answer
130 views

Copy named ranges to another workbook

I have this VBA code to copy my named cells from one workbook to another, but it gives me Error 9: Subscript out of range. Any ideas please? Sub namexfr() wbs = ...
1
vote
1answer
25 views

How can I create multiple spreadsheets using the value of a column?

I have a workbook (Req_PO_Log_V2.xls) that has all of the expenditures for our repair and maintenance funds from our current FY. The lay out is as follows: | Date | Req Number | Acct | Vendor # | ...
0
votes
1answer
65 views

Run EXCEL VBA code in separate workbooks in sequence

I have seven Excel workbooks that have macros to update them, and these are to be run every week. I want to create a macro that runs each one sequentially (and closes the previous one as some subs ...
0
votes
1answer
37 views

Force Outlook to Send Mail on or after a Specific Time

Need VBA code to send Outlook e-mail at 2.30pm, if after 2.30pm send straight away? it would need to precede Application.Dialogs(xlDialogSendMail).Show
0
votes
1answer
64 views

Outlook 2013 VBA rule random failures

My goal is no make Outlook delete all mail from a specified address keeping maximum 3 latest (it really helps with some daily subscriptions like coupons, etc.). I have lots of rules sorting mail into ...
2
votes
2answers
106 views

Excel 2013 VBA programming

I'll start off my saying I'm trying to save time for a family member who is doing this program manually. Sheet 1 Column A is a start date Column B is a projected start date Column E is a Task Name. ...
0
votes
0answers
198 views

Excel: Create a Collapsible Master-Detail View From Another Sheet?

I'm designing an excel template for importing data (into another DBMS). The problem is, the data will be separated (normalized) into several tables in my DBMS (master-detail model). Let's say I have ...
0
votes
0answers
17 views

Changing cell style groups

I was sent here from stakoverflow When I create a new cell style in Excel, it goes in a group called Custom. The standard groups include Good, Bad and Normal, Data and Model, Title and Headings, and ...
0
votes
0answers
45 views

Access 2013 : How to prevent from saving a record

I had created a form in Access 2013 to add records to a table. But I'd noticed that if I close the form without saving the record Access still saves it to the table anyway. I would like to know how to ...
0
votes
0answers
26 views

Control MS word add-ons using recorded/programmed macros

I have installed a Microsoft word add-on (Docear4Word - I think originally written in C#). The program installer places the program on the references menu of the ribbon although the buttons and ...
0
votes
0answers
33 views

Outlook - strange item.Attachments error

I have the following code, that should save a specific Excel file attached to an email. The code is combined with a rule, that triggers this script when an email with a specific subject is received. ...
0
votes
3answers
165 views

Excel macro: Last non-empty cell in a column

This is a followup question to this one. The following formula can be used to find the value of the last non-empty cell in a column, in Microsoft Excel: =LOOKUP(2,1/(A:A<>""),A:A) My ...
0
votes
1answer
252 views

excel 2010 Vba, looping through named ranges, Run-time error '1004':

I am assigning the same Macro to several OptionButtons. I try to determine in which named Range the cklicked OButton is located. So I get the Cell of the Button and loop through all named Ranges in my ...
1
vote
1answer
59 views

How can I assign Excel keyboard shortcuts for macros that use keys other than Ctrl + {alpha character}

I would like to assign keyboard shortcuts to Excel macros that use keys other than the standard Ctrl + {alpha character}. Based on this post it sounds like it is possible but I am not sure how: ...
1
vote
1answer
45 views

Show increase in trendline by using Excel vba

I have data in c5:c12 (sales1) and I plotted a graph and a trendline of this data. I also have data in d5:d12 (sales2). I would like to show an increase, graphically, in my existing trendline by using ...
0
votes
1answer
26 views

run macros assigned to many excel sheets of a workbook, with one click

I have one workbook with 8 worksheets. I have a macro assigned to each worksheet. I want to run all 8 macros from one worksheet in one click(by clicking one button, to run all 8 macros). How can ...
1
vote
3answers
40 views

Line of text is too long in VBA

I'm trying to write a macro to send a canned reply. The issue I'm having is that the body of the text is too long to fit on one line in my code. I have no idea how to have a second paragraph of body ...
0
votes
1answer
294 views

Excel VBA: How to use a unique username or save location for an export pdf macro

I have a macro that prints a uses the internal Excel method ExportAsFixedFormat to print a worksheet as a pdf and save the document to the desktop using a unique file name structure. ...
0
votes
1answer
155 views

when criteria does not match do nothing excel vba macro

I am implementing a macro that checks column E for dates that are 7 days away from current date. If cell date - current date = 7 then an email containing the row that has the matching cell, is sent ...
-2
votes
1answer
39 views

I am trying to insert a function in my VBA code to only fill a cell when another cell has data in it [duplicate]

This is my code. It fills the Date when I have this =Updating_Date(B5) typed in C5. What it is supposed to do is fill the Date ONLY when data is present in B5, and remove the Date when No data is ...
0
votes
1answer
232 views

How to lookup a value and return multiple unique values (remove duplicates) to a single cell - comma separated

I am trying to take a value (unique id) from column AC, do a lookup in column (B) and return (meaning concatenate) the multiple unique values from an adjacent column (C) to a single cell in column AD. ...
0
votes
1answer
249 views

Excel VBA: Is there a command for printing to PDF (doPDF ver 7)

As the title suggests... I'm looking to expand my automating to include directly printing to PDF. The macro(s) I have written already formats the print area and page setup as I need it. But when I go ...
0
votes
1answer
172 views

Access 2013:Trying to write macro to update form fields from a query result

I am trying to create a macro to update the value of a field in a form based off the results of a query. I am entirely new to working with vba in Access so I apologize if I am asking a basic ...
0
votes
1answer
65 views

Trying to highlight unique values across multiple sheets in Excel 2007

I am trying to compare the values from column A of Sheet1 (which I have renamed "AR") and column A of Sheet2 (which I have renamed "Paste Here") and highlight rows containing values that do not exist ...
0
votes
3answers
205 views

How to find a number after a character in VBA

How can I find a numeric value after a character in the same cell. For example: Find number 01 after J*. I have a few rows and in each row are value like J*01 or J*08. Currently I'm trying to ...
0
votes
1answer
75 views

Excel VBA embedded FOR Loop to exclude cells from the outer conditional

Starting with the following code: Dim lastRow As Long With ActiveSheet lastRow = .Range("C" & .Rows.Count).End(xlUp).Row End With Dim HeadCell As Range For Each HeadCell In ...
-1
votes
1answer
48 views

Macro to open word through excel

Sub test() Set myWorkbook = Application.Workbooks.Open(Filename:=[B1]) On Error Resume Next myWorkbook.Sheets(Cstr([D1])).Activate On Error GoTo 0 End Sub How the above macro works : ...
0
votes
1answer
301 views

Excel VBA: How to find last row of a worksheet containing actual data

I know how to find the last row of my worksheet that has any type of data or values Dim lastRow As Integer With ActiveSheet lastRow = .Range("B" & .Rows.Count).End(xlUp).Row End With ...