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

-1
votes
0answers
15 views

How can I automate the process of printing 2 rows of data from one sheet after pasting it onto the form on another sheet?

Sheet 1 of my spreadsheet has the following form: A B C D They are just columns named 'A','B','C' and 'D'. Sheet 2 has the following data: A 1 2 3 4 5 6 7 8 9 10 I want to print pages of ...
0
votes
0answers
16 views

Replacement of a string in excel with another string, taken from a csv file [on hold]

Say I have a CSV file which looks like "5.2", "Blah Blah Blah" "5.3", "Bleh" "5.4a", "Unicorns" Now, how would I go about creating a script or macro of sorts(?) so that whenever I type ...
2
votes
1answer
25 views

VBA EXcel - I am getting an error (400) if using error trap getting no object/application defined error

My excel sheet has these data, 7 columns sl.no | bed | 2| 4| 3|4|3| some times column no 7 is empty, and then only I'm getting error And my code Sub sup_cal_area_sft() Dim lru, plru As Long Dim ...
0
votes
1answer
27 views

Excel formula disappears when saving as .xls

I have a long formula in one of my cells. It is: ...
0
votes
1answer
16 views

Excel Macro to draw xyscatter plot out VBA

I am trying to create a xy plot where the x values is the time axis (column A) and the y values are in the other columns. (in the example only C and D) When I try my code from below, I get a graph ...
-1
votes
2answers
28 views

how can i make my macro toggle a sheets visibility/hide?

i have the following code that i want to toggle a sheet being visible or being hidden: Sub toggle() If Sheets("Navigation (2)").Visible = True Then ActiveWindow.SelectedSheets.Visible = False ...
0
votes
1answer
13 views

Checkout/in Excel Workbooks from SharePoint with VBA

I have found several articles and past questions in SO that help with this, but I have added a twist. I found a way to map a network drive on my PC to the SharePoint folders. If I open a workbook that ...
0
votes
1answer
25 views

VBA warning when cells selected are not equal to 5 and contiguous

My Vb macro does the following: I select 5 contiguous cells, run my macro and I get 5 static random numbers between 1 and 50; It works perfectly; I need a warning when the selected cells are not ...
2
votes
1answer
26 views

How to run a macro on a shared mailbox in Outlook 2013

I am working with my own mailbox, but also with a shared mailbox. I have a macro to automatically save attachments in e-mails which I receive, but this works only for my own mailbox and not for the ...
-1
votes
1answer
46 views

Formatting any cell referenced in a Formula

I have two sheets, one with formulas pulling data from the second. I need to create a macro or some conditional format to highlight the cell green if the data was pulled from the second sheet. sheet ...
0
votes
0answers
11 views

Running Oracle (11g) script in VBA to extract data to Excel [on hold]

We have a number of saved Oracle scripts (PL/SQL queries) that we routinely run to extract data to Excel for end users. I know its possible to convert these queries in VBA and add 'buttons' to an ...
3
votes
2answers
20 views

How to apply a macro/vba formula to more than just one cell

I have entered the follows: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$V$2" Then Range("U2") = Range("V2") * Range("O2") End If If Target.Address = "$U$2" Then ...
-1
votes
0answers
42 views

Microsoft Excel - lots of scenarios

I have an excel spreadsheet that I am using to calculate the dissociation of combustion products in the combustion chamber of an ICE to form free oxygen molecules to allow formation of nitric oxides. ...
-1
votes
0answers
22 views

Abbreviations management [closed]

I need to deal with a great number of abbreviations, so I would like to create a spreadsheet where all of them are automatically ordered as I enter each in a new cell. Also, the whole row ...
0
votes
0answers
18 views

Replicating MS Word Bookmarks [on hold]

I have to create a Word based report on products that our firm offers. Each product has about 100+ metrics. I created a table to display the metrics, and inserted bookmarks into every cell so that I ...
1
vote
1answer
23 views

Keep Canceled Meetings On Your Calendar for Reference

I like to keep track of meetings even after they were cancelled. It helps me go back to review activity taken for various topics and, sometimes, explain why I didn't go to your meeting. (E.G., "There ...
0
votes
2answers
31 views

Why does my IFNA (or ISNA) not working in a VBA module?

i have the following code: Sub TestNA2() IsThisNA = Sheets("sheet1").Range("D:D").Select 'Sheets("sheet1").Range("E:E").Select Range("E2").Formula = "=IF(ISNA(D1),""Delete"","""")" ...
0
votes
1answer
28 views

How to default Macros to run from This Workbook, NOT All Open Workbooks?

We have a macro enabled workbook (ver. 2010) that many people use. A few of these people have macros in their Personal.xlsb workbook. We have a situation where the macro in the shared workbook is ...
0
votes
2answers
24 views

Autosize cell after return of function

I have an xla with a bunch of functions. Basically each of these functions perform a vertical lookup on another worksheet. Here's a basic example of one of them: Function ...
-1
votes
0answers
28 views

how to list first 10 rows of information into it's own row and then repeat for next 10 rows

I have an exported file that skews the information lines by putting them in one column. And even then, the beginning piece of information which starts with the long numbers NXMPR... are in the ...
-2
votes
1answer
24 views

Formatting for many currencies [closed]

Does anyone know a clever way to conditional format for multiple currencies? I know that I could use conditional formatting formulas and program all those in, however, I have 154 currencies to format ...
0
votes
2answers
44 views

EXCEL VBA works with F5 - but will not run automatically when cell values are changed

The VBA formula works perfect with F5 Column E cells E3:E5 have Functions that calculate to a dollar amount or $0.00. This is the formula pulling from =SUM('MEDENT Proposal - Creator'!B15*15) ...
0
votes
1answer
17 views

EXCEL automatic Tab Color change not updating

I have a formula for Automatic Tab color change that works when I manually change the cell, but it does not work when the cell is changed by a function updating it from another sheet: =SUM('MEDENT ...
0
votes
1answer
44 views

VBA Code for SUMIF statement - Need to build-in additional conditions

I'm trying to fumble my way through some VBA scripting. I found this code online that allows for a SumIf function to occur when a single condition is met. I would like to expand it to two maybe three ...
0
votes
0answers
17 views

How can I add an image as header and footer in Word template 2010

How can I add an image as header and footer in a Word 2010 template? Also, I want to allow user control on this; e.g., place a check box, which if selected, would apply header and footer otherwise ...
0
votes
0answers
39 views

EXCEL formula - Runtime Error 28

I have a VBA that works - but leads to a Run Time Error 28 after a while. Colum B3:B11 have Hide or Show from a function in them =IF(E3=0,"Hide","Show") E3:E11 has a dollar amount or 0 from another ...
0
votes
1answer
37 views

Automatically run VBA macro whenever a cell value changes

I have a macro that works perfectly - except that I have to manually run it. I cannot figure out how to have it automatically run when I change values in other cells. Sub ...
1
vote
1answer
25 views

MS word macro: how to change highlights form a specific color to another — inside the selected text?

I want to change the yellow highlights in the selected text (not in the whole document) to red highlights. This VBA does change the highlighted colors but it does not stop at the selected text (it ...
0
votes
1answer
31 views

what is an appropriate shape name as my routine does not say?

i have the following routine that i found on the net here: http://www.ozgrid.com/forum/showthread.php?t=77662 this routine isn't working cause i dont know that shape name. can anyone tell me what the ...
0
votes
2answers
24 views

Strange residue on cell with Data Validation when using Excel VBA

I'm running into an annoying bug with Excel VBA. See this screenshot. I use an Excel worksheet as a User Input form. On the form I have several places where I put Data Validation. After the user hit ...
1
vote
2answers
27 views

Convert time duration string to seconds in excel

I have a series of data that is outputted from an application in the following format. 8d 21h 33m 30s 6m 32s 1m 40s 54m 6s 11m 32s 5d 3h 34m 30s 7m 40s 19h 57m 49s 1h 36m 9s 1m ...
1
vote
1answer
33 views

Macro does not run when opening a File/Workbook from within Excel

I'm new to Macros and VBA in general but my goal is pretty simple I believe. My macro should search an opened Excel document (automatically) and create a MessageBox with a warning if the WEEKNUM() ...
0
votes
0answers
29 views

I am using VBA for Excel to automatically generate an email with a link to a specific worksheet and cell

I am using excel to automatically generate and display an email in outlook. This email contains a PDF, a link to a folder containing documents, and a link to the file the email is sent from. So far ...
0
votes
0answers
14 views

How do I add data into combo box using vba?

I want to add unique data (From MainMenuData worksheet in same workbook) into ActiveX combo box placed on sheet1. Changed ComboBox Name from Properties to ZoneDropDown. Wrote following code on ...
2
votes
1answer
32 views

Create shared library of VBA functions in Excel

At our company we have a lot of different Excel files to keep track of our projects. We would like to implement some VBA functions in these files, written by us, the IT department. We want it so that ...
1
vote
1answer
33 views

Parse Excel to xml using VBA

I have VBA code that wirtes an Excel table to an xml file (actually writing the xml file line by line, tags equal column headers). This is the code, it is quite straight forward. Sub ...
1
vote
0answers
16 views

How can I set Microsoft Word up to change any text encapsulated in `backticks` to monospace?

I wish to be able to type `simple code` in between backticks as shown, and have Word automatically change the font to some monospace variant. I am aware of alternatives such as LaTeX, but would like ...
0
votes
0answers
21 views

why does this select statement fail? it works as a macro but not as a button

i recorded a macro that selects a sheet and then a range. it works as a macro but it fails as a button, just want to know why? Private Sub CommandButton3_Click() manfix = InputBox("Enter in fixture ...
0
votes
1answer
33 views

Excel 2010 VBA click cell trigger macro to show list of values

When clicking on cell say d2 I want to show the values from j2:j6 in e2:e6. When clicking on cell d3 I want to show the values from k2:k6 in e2:e6, etc. Can someone help me? thanks
0
votes
0answers
15 views

Detect that an email is marked as read and save it

My outlook VBA code aims at doing the following: In the event of selection change (i.e. say the user clicks on a different email in the inbox) If [the previous selection was 'Unread' and became ...
0
votes
1answer
43 views

In Excel, make radio button active/inactive depending on cell value

I want to make an Excel radio button active/inactive, depending on the value of another cell. I made the following attempt: Sub test() If ActiveSheet.Cells(9, 3).Text = 3 Then ...
30
votes
9answers
3k views

Limit Excel CPU Usage

Is there a way to limit how much CPU usage excel has access to when running? I have a VBA script that calculates a bunch of giant array formulas. The entire calculation takes maybe 20 minutes using ...
1
vote
3answers
22 views

Backing up Word VBA Macros

I just inadvertently deleted a couple of functions that I needed and am having to recreate them. Is there a way to back up Word VBA macros themselves? Preferably one that's quick and easy and/or ...
0
votes
2answers
47 views

Change periods to commas and vice versa in UDF

I have this Excel UDF to exclude all non-numeric characters from a cell, except periods and commas; But before it cleans my number I would like to change all commas to periods and vice versa. I have ...
0
votes
1answer
35 views

VBA - Type mismatch error with for loop and 2D array

What I am trying to do is copy one array to a temporary array while I resize the original array and then copy the temporary array back to the resized original. But I am running into the error "type ...
0
votes
1answer
53 views

Sort Excel File Natural Order

How might I sort an excel file by Natural Order based on a column with either VBA or Mathematica? This question is similar although probably not as complex. In addition how can I ignore a heading ...
6
votes
2answers
188 views

How do I get the last worksheet in Excel VBA?

I have a sheet called "End" that needs to be moved to be the last of all available sheets. I need to do this using VBA. I have a sort routine that works, I just need the syntax for the move. Here is ...
0
votes
3answers
39 views

DateDiff() producing inaccurate answers

I am trying to write a bit of code that will use the DateDiff function to get the difference in days between two dates. I will then use this number to determine where to enter data on my spreadsheet. ...
0
votes
1answer
52 views

VBA in Excel 2013, Loop through files where the wildcard applies to the subdirectory

I have a MATLAB script that analyzes experimental results on a number of widgets my company makes, and finally exports the summarized data into a CSV file. I want to import all of these csv files into ...
0
votes
0answers
30 views

Need to extract specific data from a very big and confused excel file

I've a very big and confused excel file. This is the excel conversion of a big pdf manual. This file contains many part number in these format (n=number, l=letter): nnnnnnn (ex.1234567) nnnnnnn-n ...