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

2
votes
1answer
132 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
149 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
56 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
31 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
108 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
43 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
130 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
22 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
58 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
218 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
32 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
73 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
44 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
2answers
91 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
119 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
250 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
18 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
73 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
35 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
175 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
332 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
91 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
52 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
28 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
51 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
366 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
195 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
48 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
294 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
392 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
238 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
75 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
347 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
109 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
95 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
539 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 ...
0
votes
1answer
112 views

Pass Parameters from vba to vbs

I'm trying to pass arugements to my vbscript from vba. Shell "wscript C:\test.vbs " & strName & fileDir But in the vbs its taking it as one arguement. How to pass two different ...
0
votes
0answers
129 views

How to show all the worksheets on user form in vba?

I used my code to open up workbook, after I select the workbook, I want to prompt user form which will display all the worksheets which belong to the workbook. Here is my code: Function ...
1
vote
2answers
62 views

How to I simplify code that combines information and adds up values for certain columns?

I am revamping some VBA code that was done 15 years ago that someone else created. I have to add more code to fit our needs but I exceed the amount of code allowed to run. I have a Products in ...
0
votes
1answer
67 views

Visual Basic Debug in Excel

I had a workbook created for me. I made a mistake and deleted an entire row from the Master Page and now I am getting a debug error and #REF! on the UC-K sheet. The error says Run-Time Error '13': ...
0
votes
2answers
242 views

Hide rows based on the value of another cell

First, I've tried these threads, to no avail (1, 2, and others which I am prohibited to mention since my rank doesn't allow for more than two links). I am almost certain I'm just missing some simple ...
1
vote
1answer
28 views

How do I change color every time my length is bigger then 5 character in VBA

How can turn my color into green when my length exceed more then 5 characters. I keep getting "object doesn't support this property" error Sub deme() Dim lastrow As Long Dim a As ...
0
votes
1answer
64 views

How do I prompt with a msgbox VBA [closed]

How do I prompt with a msgbox in VBA, when excel rows are changing to different letters. For example if I have AAB in row1 and BBA in Row2, I need a prompt box after row1.
1
vote
1answer
258 views

How do you unprotect the VBA macros for a macro-enabled workbook if you forgot the password?

I have heard myths about how easy it is to crack a VBA macro password, but haven't been able to figure out how to do it myself. We have an excel file at work where the VBA is password protected and ...
0
votes
2answers
32 views

Ignore an empty text field

I keep getting a cast exception when running a subroutine in a userform. It recognizes the null value when it reads txtMileage.text = "" and throws an error because it's trying to determine if the ...
0
votes
1answer
298 views

Excel: How to search multiple workbooks for Cell information

Good Afternoon Currently we receive e-forms filled out with excel from our customers, so I have a folder filled with workbooks. Each workbook has multiple sheets. I need to search through each of ...
0
votes
2answers
90 views

Is it possible to have an excel workbook automatically save as macro-enabled if macro is added to the workbook?

Currently, in Excel 2010, when I try to save a workbook that I have created as a .xlsx file but added a VBA function or subroutine to, Excel gives a prompt asking (in a round-about way) if I want to ...