VBA stands for Visual Basic for Applications, a subset of Visual Basic used in all Microsoft Office Applications. Consider tagging your question with the application as well as [VBA]

learn more… | top users | synonyms

0
votes
0answers
53 views

How do I really enable events in Word VBA?

I've found the instructions to enable events, but this does not always work. When I create a new document from a template events are not enabled. I've got the class module to have word run with ...
1
vote
1answer
38 views

How do I access a new document in vba?

I made a .dot template with a few macros. However, when I create a new document based on the template I run into trouble. If I reference activedocument, I get the message that no document is open. So ...
-4
votes
1answer
78 views

VBA for “IF formula” with multiple results in a single cell [closed]

How can I convert this to VBA? Using this formula, it cover 6 rows only and the formula is already too long. My report has 600 rows. =IF(AND('Risk & Issue Log'!$K$2=$D5,'Risk & Issue ...
0
votes
0answers
57 views

Convert OO4 ODS to XLSX using Excel 2010 VBA

I am trying to bulk convert OpenOffice documents to Microsoft Office. Using built-in VBA, I use the following code (ODS to XLSX is shown, but same code is being used for ODT and ODP with some ...
-1
votes
1answer
36 views

Format of Row in VBA based on 1stCell and also Compare to above row?

I was wondering how would i through VBA conditionally format the whole row or a row in a range based on the first cell in that row? Also it would require a comparison to the previous row to current ...
0
votes
0answers
132 views

How do I set spacing between paragraphs while keeping numbering in word vba?

I'm trying to write a macro that does the following to a selection: Keeps paragraphs that are numbered numbered Keeps paragraphs that are unnumbered unnumbered Sets line and paragraph spacing Puts ...
0
votes
3answers
75 views

Are there events defined in the word vba object model for these events?

First of all, I did look and did not find any. I want a macro to run whenever one of the following happens: The document is opened The document is saved Text is pasted into the document The ...
0
votes
0answers
138 views

Excel test generator inserts extra data. VBA

I build a random test generator for Excel using VBA. It will randomly pull questions from a test question bank. It will also add the answers in a different cell. However, I found that occasionally ...
1
vote
1answer
40 views

Searching the string in a text sitting on 1 coulmn

I'm very new into VBA coding, I would like to have some assistance as I have been trying for two days, I have got data fixed in column A, I would like to search for a string in that column, eg ...
2
votes
0answers
184 views

How do I replace all breaks in a selection in Word using VBA?

I've got a part of a document selected, and now I want to replace all manual page and section breaks (the latter of all types, such as next page even, next page uneven, next page, continuous, column) ...
0
votes
1answer
751 views

How do I select text between two “bookmarks” in Word VBA?

Note: Originally I asked how to select text from a certain point downward, but I've got a solution for that: Dim f As Word.Field For Each f In ActiveDocument.Fields If f.Type = wdFieldAddin And ...
0
votes
0answers
27 views

Macro for hiding table colums, in multipile files, and another on to reverse it

I know almost anything about VBA so I can't really code the Macro that I need for MS Word. I hope that I could get some help here. The basic functionality that I want is to take a Word document with ...
0
votes
1answer
135 views

Excel - How can I highlight duplicate cells in near-matching worksheets?

I'm running a March Madness bracket tournament using Excel spreadsheets. I have one sheet where I will input the actual winners. I have an additional sheet per participant that is near-identical, only ...
0
votes
1answer
41 views

New instance of Excel does not see already opened instance

I have Avizo.xlt with one Worksheet and a code which intended to put this WS inside already opened document, which is SLK report made by our ancient ERP system, and close this document. Everything ...
0
votes
0answers
11 views

Change font of cell automatically without changing font of text already placed in the cell - Excel 2010

I would like to be able to have the font automatically change color when double clicking on the cell without changing the font of the text that is already in the cell. Is that possible?
1
vote
1answer
47 views

How to remove “no cents” when spelling out cents less dollar figures in Excel?

Currently, I am spelling out dollar values using a module from the Microsoft support website. Here is the link http://support.microsoft.com/KB/213360 I am able to spell out dollar values in Excel ...
0
votes
1answer
68 views

Is this possible in Excel? (VBA)

I want to create a VBA macro that will do the following: The Excel file with the Macro should only open when the file is opened from a certain folder in the Windows directory. If it is not opened ...
0
votes
1answer
806 views

Show or hide rows in an excel sheet subject to the value of a particular cell (excel 2007 & Windows 7)

I have made a spreadsheet to specify decoration selections from a range of standard options. There are five separate ranges so this is the first selection then within each range there are additional ...
0
votes
1answer
205 views

How to Replace Words With VBScript Regex and VBA?

what is vbscript syntax for .net: \b[a-z]+\b Hi trying to replace all alpha words in the source. .net regex tester confirms this pattern will find all words: \b[a-z]+\b this: ...
0
votes
1answer
89 views

VBA Excel: Sub procedure to change caption in a UserForm control

I'm creating a user form that shows the value(numeric) of the last used cell in a column. I'm just guessing on how to do it but it doesn't work, this is what I got: Sub show() UserForm1.show ...
0
votes
1answer
974 views

Call PowerShell script from Excel

Excel 2010 I'm trying to call a PowerShell script from a macro in Excel. I have seen a number of examples along the lines of: retval = Shell("powershell ""C:\MyTest.ps1""", 1) When I try to use this, ...
0
votes
1answer
65 views

Autoforward Outlook emails to external only under certain circumstances

Is there a modification that can be made to the VBA code provided in this response from an earlier post that would only forward email from a certain email address rather than forwarding everything? ...
0
votes
1answer
134 views

Can Excel's Find formula have multiple find_text criteria?

I have a list of names on a NAMES tab range A1:A100. On another tab 'Data Export', in column A I have an export of thousands of comments where one of those names from the NAME tab can be found within ...
0
votes
1answer
66 views

How to combine several excel workbooks into a single book

I have several, multi-sheet workbooks which I would like to combine so that I can search them all simultaneously. So, the merged workbook will contain tabs 1,2,3, of the first workbook, then tabs ...
0
votes
1answer
2k views

VBA Excel: Function to find a string in another workbook

I'm trying to create a function that searches a string (bom) in two different workbooks and returns a value next to that string. I know the ranges in those workbooks where I want to perform the ...
1
vote
1answer
63 views

How to know which macro is assigned to a certain toolbar button in Word 2003

I have a Word 2003 toolbar made by someone else long time ago. The toolbar contains lots of buttons and assigned macros. Until now I have been able to set breakpoints in the VBA code in order to ...
0
votes
1answer
42 views

Adding two numbers using macros failed to execute

How to add 2 numbers using macros? I tried below but i am not able to execute. Sub auto_open() n1 = InputBox("enter fiest number") n2 = InputBox("Enter 2nd number") ...
0
votes
1answer
53 views

Passing an element name using a variable in VBA

I have a multi page element on a MS Access form and I am trying to use GetArgs to identify which page to open using the below code. Dim WrdArray() As String If Not IsNull(Me.OpenArgs) Then ...
0
votes
1answer
86 views

How to create a custom “Shapes” menu in Powerpoint

By the "Shapes Menu," I mean the menu that you get to from the ribbon by going to Home -> Shapes. I would like to either: Choose my own shapes for within the Shapes menu, including changing the ...
0
votes
1answer
348 views

VBA Excel: How to select only numeric values in a range?

I used Range.Find to locate a string called "Qty", now I want to select all the numbers in that column. I would use .End(xlDown) to get the last row, however the last used cell in that column is not ...
0
votes
3answers
52 views

Excel: Classifiying data based on a bin system

I'm working with excel 2010 on windows, am a novice excel user but I can program, so you are welcome to throw VBA at me. I have a series of cells where a user can enter a number and another cell needs ...
1
vote
1answer
71 views

VBA Excel: Error during range selection during workbooks iteration

I have several files in one folder with the column "Part Number" but not all of them are in the same column number. The list doesn't necessarily start in the same row either. So I first look for the ...
1
vote
1answer
274 views

Excel 2010 VBA only affecting last row in range

I have some VBA code written in Excel 2010 to force padding around the rows in a table, but part of the code only affects the last row in the range. Here's the full code: Private Sub ...
0
votes
0answers
109 views

How to distribute one (1) Word 2010 template file with [macros, custom ribbon tab, quick style set]

I am developing a macro enabled Word 2010 template: MyTemplate.dotm. At the moment MyTemplate.dotm is mainly containing a ribbon with callbacks to VBA-logic, "native" in MyTemplate.dotm: ...
1
vote
0answers
50 views

From outlook RSS: Download attachment, rename the file and save it to a folder

I know that it should be possible but can someone give me a script to do this? At least some hints how to do it is appreciated.
2
votes
5answers
199 views

Extracting Characters from Folder Path in Excel

I have a huge list of folder paths as text in an Excel worksheet from which I would like to extract the number after each backslash. These numbers then need compiling into a shortened reference. For ...
0
votes
1answer
511 views

Deleting entire row in excel if missing data in certain column or columns?

I just downloaded a Micosoft CSV file from Google Contacts and I would like to modify it so that I can organize the contacts in my phone. I am going back to my "dumb" phone as part of an experiment of ...
0
votes
0answers
58 views

Excel add picture from another worksheet in comment box

I have index worksheet that is used as a table of contents that link to other sheets. I would like to show a preview of the pictures on the other sheets. I learned that the best way to do it is insert ...
0
votes
1answer
3k views

Excel vba code for adding a value to existing cell of sheet

i have this code to add value of a cell to existing value of other cell which is below Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Not (Intersect(Target, Range("E3")) Is Nothing) ...
0
votes
2answers
269 views

Excel 2010 formula, How do I write this formula? (VBA)

I need a bit of help from the more experienced Excel VBA users. Basically I have 2 groups of 3 cells (6 cells total) If one group of 3 cells is filled in it needs to accept it and not return a ...
1
vote
1answer
190 views

Excel 2007 VBA code to aggregate data based on conditions and calculate a weighted average

I am importing data from a trading system that has buy and sell orders for multiple securities(stocks). I need to aggregate the same security buy orders and the same security sell orders, creating a ...
0
votes
1answer
4k views

Split Excel worksheet into multiple worksheets based on a column with VBA

Question is simple and may be repetitive. I have an Excel workbook which contains around 50 columns I have a criteria column for splitting this workbook into mulitple workbooks The approach is as ...
0
votes
1answer
49 views

How to call a namer range using a variable to define the name

According the documentation, any quoted text names can be defined by a variable If I define Set xlsDataSource = Application.Workbooks("New_TOR_V1.xlsm").Names("MyRange").RefersToRange it works as ...
0
votes
1answer
19 views

Format a document using styles with macro

I have a document where I have created some styles. The content in this document is manually tagged. That is, where Heading 1 is to be applied it is tagged as H1 and the same way for Heading 2, ...
1
vote
2answers
59 views

Workbook doesn't find macro

I created a macro in a workbook which is being used by several persons on their own computers. For some of them, it seems to work fine, but for other a message appears that it can't find the macro on ...
0
votes
1answer
296 views

VBA string search within files in directory not working in Excel 2007

I'm trying to look for a string within a folder containing several files. Once the string is found it should select and copy a value in an adjacent cell 5 columns to the right(Offset(0,5)), then paste ...
0
votes
1answer
169 views

Outlook 2010 Run Script via Rules

I have the following subroutine in ThisOutlookSession: Sub receiveMtgRequest(Item As Outlook.MailItem) MsgBox "You have received a meeting request: " & Item.Subject End Sub I have set it to run ...
0
votes
0answers
95 views

Outlook VBA not recognising Inbox subfolder

There are 3 email addresses controlled by Outlook. When an email arrives to a specific email account, a specific word in the subject line directs the email to one of 2 sub-folders: PHY2048 or PHY2049. ...
0
votes
1answer
153 views

How to merge rows with same Name merging data of each ?related column

I need to merge rows with same Name preserving data of each column. For example, if we have two rows with the name "Mr Bean" on the first column "Name" then merge data of each column related to rows ...
0
votes
1answer
313 views

How to combine values from multiple rows into a single row using module?

I'm looking to combine multiple rows into a single row based on a value in the code column.. I've noticed other questions on here similiar to my question but I cannot seem to extend the range.. Code ...